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

[abb] fallback to full context with dataList #4181

Open
kaby76 opened this issue Jul 31, 2024 · 0 comments
Open

[abb] fallback to full context with dataList #4181

kaby76 opened this issue Jul 31, 2024 · 0 comments

Comments

@kaby76
Copy link
Contributor

kaby76 commented Jul 31, 2024

Generate a parser for abb, build, and perform a trperf. You find a fallback to full context for dataList.


07/31-14:13:39 ~/issues/g4-current/abb
$ trgen -t CSharp
C:\msys64\home\Kenne\issues\g4-current\abb
CSharp  abbParser.g4 success 0.0376472
CSharp  abbLexer.g4 success 0.0081164
Rendering template file from CSharp/Other.csproj to ./Generated-CSharp/Other.csproj
Rendering template file from CSharp/st.build.ps1 to ./Generated-CSharp/st.build.ps1
Rendering template file from CSharp/st.build.sh to ./Generated-CSharp/st.build.sh
Rendering template file from CSharp/st.clean.ps1 to ./Generated-CSharp/st.clean.ps1
Rendering template file from CSharp/st.clean.sh to ./Generated-CSharp/st.clean.sh
Rendering template file from CSharp/st.Encodings.cs to ./Generated-CSharp/st.Encodings.cs
Rendering template file from CSharp/st.ErrorListener.cs to ./Generated-CSharp/st.ErrorListener.cs
Rendering template file from CSharp/st.makefile to ./Generated-CSharp/st.makefile
Rendering template file from CSharp/st.perf.sh to ./Generated-CSharp/st.perf.sh
Rendering template file from CSharp/st.ProfilingCommonTokenStream.cs to ./Generated-CSharp/st.ProfilingCommonTokenStream.cs
Rendering template file from CSharp/st.run.ps1 to ./Generated-CSharp/st.run.ps1
Rendering template file from CSharp/st.run.sh to ./Generated-CSharp/st.run.sh
Rendering template file from CSharp/st.test-cover.sh to ./Generated-CSharp/st.test-cover.sh
Rendering template file from CSharp/st.Test.cs to ./Generated-CSharp/st.Test.cs
Rendering template file from CSharp/st.test.ps1 to ./Generated-CSharp/st.test.ps1
Rendering template file from CSharp/st.test.sh to ./Generated-CSharp/st.test.sh
Rendering template file from CSharp/Test.csproj.st to ./Generated-CSharp/Test.csproj.st
Copying source file from C:/msys64/home/Kenne/issues/g4-current/abb/readme.txt to ./Generated-CSharp/readme.txt
Copying source file from C:/msys64/home/Kenne/issues/g4-current/abb/o.pt to ./Generated-CSharp/o.pt
Copying source file from C:/msys64/home/Kenne/issues/g4-current/abb/desc.xml to ./Generated-CSharp/desc.xml
Copying source file from C:/msys64/home/Kenne/issues/g4-current/abb/abbParser.g4 to ./Generated-CSharp/abbParser.g4
Copying source file from C:/msys64/home/Kenne/issues/g4-current/abb/abbLexer.g4 to ./Generated-CSharp/abbLexer.g4
07/31-14:13:47 ~/issues/g4-current/abb
$ cd Generated-CSharp/
07/31-14:13:50 ~/issues/g4-current/abb/Generated-CSharp
$ make
bash build.sh
  Determining projects to restore...
  Restored C:\msys64\home\Kenne\issues\g4-current\abb\Generated-CSharp\Test.csproj (in 791 ms).
  Determining projects to restore...
  All projects are up-to-date for restore.
  Test -> C:\msys64\home\Kenne\issues\g4-current\abb\Generated-CSharp\bin\Debug\net8.0\Test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.00
07/31-14:13:57 ~/issues/g4-current/abb/Generated-CSharp
$ trperf -c Fdrf ../examples/robdata.sys -h | column -t
Time to parse: 00:00:00.0369238
File                     Decision  Rule               Fallback
../examples/robdata.sys  0         moduleData         0
../examples/robdata.sys  1         moduleName         0
../examples/robdata.sys  2         dataList           0
../examples/robdata.sys  3         dataList           1
../examples/robdata.sys  4         procedure          0
../examples/robdata.sys  5         procCall           0
../examples/robdata.sys  6         procParameter      0
../examples/robdata.sys  7         functionCall       0
../examples/robdata.sys  8         functionParameter  0
../examples/robdata.sys  9         declaration        0
../examples/robdata.sys  10        init_              0
../examples/robdata.sys  11        expression         0
../examples/robdata.sys  12        array_             0
../examples/robdata.sys  13        primitive          0
../examples/robdata.sys  14        primitive          0
../examples/robdata.sys  15        primitive          0
07/31-14:14:04 ~/issues/g4-current/abb/Generated-CSharp

dataList has a fallback to full context. This is because dataList => NEWLINE, and FOLLOW(dataList) = NEWLINE.

Removing the first alt in dataList for NEWLINE will remove the full context fallback.

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

No branches or pull requests

1 participant