Conversation
There was a problem hiding this comment.
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 * Typearray syntax with modernType[X]bracket notation - Extends
ArraySpecandPackedArrayto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
X * Typesyntax in favour ofType[X]ArraySpecandPackedArrayto support any number of dimensionsmy_type_t : pkg_a::some_type_t[1][2]works)