-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Generate identical atn simulation output across targets to compare parsing functionality #3957
Conversation
@kaby76 @ericvergnaud @KvanTTT getting somewhere on this. Added some basic infrastructure and a command line tool. |
Run this so we get right jars before trying this script:
Run the script from
or whatever your test grammar, start rule, target, test input are. Here is traceatn.sh: export ANTLRJAR=/Users/parrt/.m2/repository/org/antlr/antlr4/4.11.2-SNAPSHOT/antlr4-4.11.2-SNAPSHOT-complete.jar
export TESTJAR=/Users/parrt/.m2/repository/org/antlr/antlr4-runtime-testsuite/4.11.2-SNAPSHOT/antlr4-runtime-testsuite-4.11.2-SNAPSHOT-tests.jar
export JUPITER=/Users/parrt/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.9.0/junit-jupiter-api-5.9.0.jar
export OPENTEST=/Users/parrt/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
java -classpath $ANTLRJAR:$TESTJAR:$JUPITER:$OPENTEST org.antlr.v4.test.runtime.TraceATN $@ |
Besides the hardwired user info in traceatn.sh, ':' path separators, it works fine on Windows for Java, but get no output for anything else (I have all targets installed). |
Note: dotnet is the "go to" build tool for CSharp. MSBuild is not. In fact, I call "dotnet msbuild" if I want that explicitly. "dotnet" has tool packages that can be easily installed and works without any environment variable changes. That's why "Trash" package the apps as dotnet tools. All the other target tools are on PATH. For Cpp:
|
Yeah, that must be something that's baked into the test rig. If you turn on WATCH_COMMANDS_EXEC in RuntimeRunner, you'll see the sequence of command during testing. Happy to replace as you suggest. |
…ava target. Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
…et to get ATN output to stdout. Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
This reverts commit bca48be.
This reverts commit a3197e1.
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
…sting. Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
2. Pass RunOptions to all the runners during init 3. Make C++ set a cmake file if traceATN is set. Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Ok, and now C# looks like Java! @ericvergnaud 19344b8 |
@marcospassos Could you update PHP target to reflect one of this commits so PHP ATN simulation trace output is same so we can compare parsing behavior? Not required but could be useful to you. Found issues with Go and JS for example :) Here is C# commit: 19344b8 |
Signed-off-by: Terence Parr <parrt@antlr.org>
I can't get Swift to build so I can't update that target. I'm out of gas on this so I'll merge if tests pass, leaving Swift/PHP to update if somebody wants to help. |
Sure! |
Trying to use this in comparing CSharp vs PHP. In my CSharp driver, I set
In my PHP driver, I set
I would expect the trace functionality to have the same semantics. Basically the PHP trace is unusable at this moment in dev branch of https://github.com/antlr/antlr-php-runtime. I can sed -E the output, but doing so isn't right. |
Well, it seems that the "trace" that is activated by antlr4/runtime/CSharp/src/Parser.cs Line 30 in 76fa05c
This code is pretty old, and has nothing to do with this PR. But it looks like nobody tested the PHP target. |
### What changes were proposed in this pull request? This pr is aims upgrade `antlr4` from 4.9.3 to 4.13.1 ### Why are the changes needed? After 4.10, antlr4 is using Java 11 for the source code and the compiled .class files for the ANTLR tool. There are some bug fix and Improvements after 4.9.3: - antlr/antlr4#3399 - antlr/antlr4#1105 - antlr/antlr4#2788 - antlr/antlr4#3957 - antlr/antlr4#4394 The full release notes as follows: - https://github.com/antlr/antlr4/releases/tag/4.13.1 - https://github.com/antlr/antlr4/releases/tag/4.13.0 - https://github.com/antlr/antlr4/releases/tag/4.12.0 - https://github.com/antlr/antlr4/releases/tag/4.11.1 - https://github.com/antlr/antlr4/releases/tag/4.11.0 - https://github.com/antlr/antlr4/releases/tag/4.10.1 - https://github.com/antlr/antlr4/releases/tag/4.10 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Actions ### Was this patch authored or co-authored using generative AI tooling? No Closes #43075 from LuciferYang/antlr4-4131. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Sean Owen <srowen@gmail.com>
### What changes were proposed in this pull request? This pr is aims upgrade `antlr4` from 4.9.3 to 4.13.1 ### Why are the changes needed? After 4.10, antlr4 is using Java 11 for the source code and the compiled .class files for the ANTLR tool. There are some bug fix and Improvements after 4.9.3: - antlr/antlr4#3399 - antlr/antlr4#1105 - antlr/antlr4#2788 - antlr/antlr4#3957 - antlr/antlr4#4394 The full release notes as follows: - https://github.com/antlr/antlr4/releases/tag/4.13.1 - https://github.com/antlr/antlr4/releases/tag/4.13.0 - https://github.com/antlr/antlr4/releases/tag/4.12.0 - https://github.com/antlr/antlr4/releases/tag/4.11.1 - https://github.com/antlr/antlr4/releases/tag/4.11.0 - https://github.com/antlr/antlr4/releases/tag/4.10.1 - https://github.com/antlr/antlr4/releases/tag/4.10 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Actions ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#43075 from LuciferYang/antlr4-4131. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: Sean Owen <srowen@gmail.com> (cherry picked from commit 13cd291)
Per #3814 trying to debug ATN sim. For ref, previous thoughts: #3817