Skip to content

Conversation

@Intuity
Copy link
Owner

@Intuity Intuity commented Aug 29, 2025

  • Adds support for multidimensional packed arrays into both the Python and custom grammars
  • Deprecates the previous X * Type syntax in favour of Type[X]
  • Extends ArraySpec and PackedArray to support any number of dimensions
  • Supports inline foreign references in the custom grammar (i.e. my_type_t : pkg_a::some_type_t[1][2] works)
  • Documentation, tests, and examples updated
  • Custom grammar parser now supports multiple packages appearing in one file

@Intuity Intuity requested a review from Copilot August 29, 2025 14:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive support for multi-dimensional arrays to both Python and custom grammar syntaxes, replacing the previous X * Type syntax with the new Type[X] format. Key changes include extending the core array infrastructure to handle arbitrary dimensions, updating the grammar parser to support multiple packages per file, and providing comprehensive test coverage for the new functionality.

  • Replaces X * Type array syntax with modern Type[X] bracket notation
  • Extends ArraySpec and PackedArray to support multi-dimensional arrays with arbitrary depth
  • Updates grammar parser to handle multiple packages in a single file and inline foreign references

Reviewed Changes

Copilot reviewed 39 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/utils/test_utils_constant.py Updates test to handle multiple packages in parse output
tests/utils/test_utils_basic.py Updates imports and type references for scalar refactoring
tests/pysyntax/test_struct.py Updates array syntax from X * Type to Type[X] format
tests/pysyntax/test_package.py Updates array syntax from X * Type to Type[X] format
tests/pysyntax/test_array.py Comprehensive test suite for multi-dimensional array functionality
tests/grammar/*.py Updates all grammar tests to handle multiple packages per file
pyproject.toml Version bump to 3.0.2
packtype/utils/union.py Updates scalar type references for refactoring
packtype/utils/struct.py Updates scalar type references for refactoring
packtype/utils/basic.py Major refactoring of type handling and addition of scalar utilities
packtype/utils/array.py New utility module for array-related operations
packtype/utils/init.py Exports new array utilities and scalar checking functions
packtype/types/scalar.py Refactors Scalar into ScalarType base with backward compatibility
packtype/types/primitive.py Splits NumericType from NumericPrimitive for better type hierarchy
packtype/types/package.py Updates type filtering and scalar reference handling
packtype/types/base.py Adds __getitem__ method for array syntax and metadata support
packtype/types/assembly.py Updates array range calculation for multi-dimensional support
packtype/types/array.py Complete rewrite to support multi-dimensional arrays
packtype/templates/package.sv.mako Updates SystemVerilog template for new array syntax
packtype/start.py Updates imports and loop handling for multiple packages
packtype/registers/registers.py Updates type references for scalar refactoring
packtype/grammar/transformer.py Major updates to support new array dimensions and foreign references
packtype/grammar/packtype.lark Grammar updates for dimensions, foreign references, and multi-package support
packtype/grammar/grammar.py Parser updates to yield multiple packages and handle foreign references
packtype/grammar/declarations.py New declaration types and dimension handling logic
examples/*/registers.py Updates array syntax from X * Type to Type[X] format
examples/arrays/* New comprehensive example demonstrating multi-dimensional arrays
docs/syntax/arrays.md New documentation for array syntax and usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Intuity Intuity merged commit 935ec69 into main Aug 29, 2025
6 checks passed
@Intuity Intuity deleted the intuity/arrays branch August 29, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants