Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[golang] Fixes for #4460 and #4462 (ambiguities) #4461

Merged
merged 13 commits into from
Apr 9, 2025
Merged

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Apr 1, 2025

This PR fixes #4460 and #4462. It changes the grammar to have a rudimentary symbol table, rewrites the primaryExpr to be left-recursion free, and adds critical disambiguation logic to the primaryExpr rule alts. That change improves the performance of the parser with another halving of the runtime of the test suite over #4458.

This PR also fixes #4462. An ambiguity was detected in an if-statement test.

Also changed in this PR is the template for testing Cpp. There has been a change in CMake on Windows where older versions are not supported. It was necessary to patch the Antlr runtime for Cpp. antlr/antlr4#4808

kaby76 added 2 commits April 1, 2025 06:20
With the fixes, parse time for the "fmt" package is more than twice as fast as before all these ambiguity fixes.
@kaby76
Copy link
Contributor Author

kaby76 commented Apr 2, 2025

Waiting on #4458 to be merged.

@kaby76 kaby76 changed the title [golang] Fix for #4460: disambiguating primaryExpr. [golang] Fixes for #4460 and #4462 Apr 2, 2025
@kaby76 kaby76 changed the title [golang] Fixes for #4460 and #4462 [golang] Fixes for #4460 and #4462 (ambiguities) Apr 2, 2025
@kaby76 kaby76 marked this pull request as ready for review April 6, 2025 19:22
@kaby76
Copy link
Contributor Author

kaby76 commented Apr 6, 2025

@teverett This PR is all set. Thanks.

@KvanTTT KvanTTT added the go label Apr 7, 2025
@teverett
Copy link
Member

teverett commented Apr 9, 2025

@kaby76 thanks!

@teverett teverett merged commit c2909fc into antlr:master Apr 9, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[golang] "if len(ss) == 0 {" is ambiguous. [golang] Ambiguity betweeen "operand" and "methodExpr".
3 participants