Skip to content

Conversation

@teofr
Copy link
Contributor

@teofr teofr commented Dec 31, 2025

The PR is huge, but most of the changes are generated or snapshot tests. The actual changes can be summarised as:

  • We create a ParserModel, where each item from the language is transformed into a model of an LALRPOP rule
  • From the ParserModel we generate an actual LALRPOP grammar (grammar.lalrpop.jinja2)
  • We add a ParserOptions construct to the language definition, allowing for some grammar specific options
    • Some complex language items have their rules written by hand within the language definition, these are copied verbatim. I tried to be very didactic in the comments explaining this manual rules, if something is not clear please let me know.
  • The pragma and assembly blocks require context switching from the lexer, until then they're basically being ignored
  • These are the tests that generate different ASTs between V1 and V2, please review them carefully:
    • solidity_cargo_tests cst::cst_output::generated::source_unit::braces_inside_assembly: This needs assembly blocks to be parsed correctly.
    • solidity_cargo_tests cst::cst_output::generated::source_unit::state_variable_function: V1 parse this function (uint a) internal internal foo; as the function type having two internal attributes, but the second should be an attribute of the state variable, this works as expected on V2.
    • solidity_cargo_tests cst::cst_output::generated::source_unit::unreserved_keywords: V1 can't parse this uint transient;, V2 correctly parse it as an uint with the transient identifier (not a storage attribute).

@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

⚠️ No Changeset found

Latest commit: aba296f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch 2 times, most recently from 445da70 to a06179b Compare January 7, 2026 13:08
@teofr teofr changed the base branch from teofr/v2-ast-2 to teofr/node_checker January 7, 2026 13:18
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch from 69af5d6 to 3a7f5ae Compare January 7, 2026 20:34
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch from 99bcd05 to 9f5d166 Compare January 19, 2026 12:13
@teofr teofr force-pushed the teofr/node_checker branch from 2f7d455 to acfa26c Compare January 19, 2026 12:36
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch from 9f5d166 to 8150fcf Compare January 19, 2026 12:38
@teofr teofr force-pushed the teofr/node_checker branch from acfa26c to 4cc4786 Compare January 22, 2026 14:35
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch 2 times, most recently from 8d49a31 to 6711af3 Compare January 22, 2026 16:12
@teofr teofr force-pushed the teofr/node_checker branch from 4cc4786 to 072144d Compare January 23, 2026 10:14
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch from 6711af3 to 4b6bc06 Compare January 23, 2026 10:15
@teofr teofr force-pushed the teofr/node_checker branch from 072144d to d95ed0d Compare January 28, 2026 09:05
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch 3 times, most recently from 18a9e63 to 3bd60df Compare January 28, 2026 10:07
@teofr teofr changed the base branch from teofr/node_checker to teofr/v2-definition-changes January 28, 2026 10:07
- Generating LALRPOP grammar rules
- Changes in the language definition
- Added some tests and comparison against V1

Some more small fixes
@teofr teofr force-pushed the teofr/lalrpop-parser-squashed branch from 3bd60df to d16de5a Compare January 28, 2026 13:45
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