You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use CPP to build my parser, but got error: Segmentation fault (core dumped). However, when I use Python to build, it works normally. My ANTLR4 tool version is 4.13.2.
When I change rule extra_decls: LeftBrace extra_decl (Comma extra_decl)* RightBrace; to extra_decls: LeftBrace extra_decl (Comma extra_decl)* RightBrace; , or change atom_suffix: Less identifier Greater; to atom_suffix: LeftBrace identifier RightBrace;, it works.
I think there maybe something wrong with antlr4 CPP runtime. I wonder why and how to fix it.
The input doesn't parse {assign_stmt}; of your input because you don't use LeftBrace or the string literal { anywhere in the parser grammar. Also, UniASRLexer.g4 is not the file name. It should be UniASTLexer.g4 because it's declared lexer grammar UniASTLexer;. Thus, it appears you have a build issue. I recommend that you write a build script to clean up all generated files, run the Antlr tool, and recompile everything from scratch. As you are using the Cpp target, write a Bash script with the two Antlr tool calls in the correct order, followed by the g++ or whatever compiler you are using afterwards. The segv looks like you do not have the compiler and linker flags correct, e.g., you are not compiling with pthreads.
I use CPP to build my parser, but got error:
Segmentation fault (core dumped)
. However, when I use Python to build, it works normally. My ANTLR4 tool version is 4.13.2.When I change rule
extra_decls: LeftBrace extra_decl (Comma extra_decl)* RightBrace;
toextra_decls: LeftBrace extra_decl (Comma extra_decl)* RightBrace;
, or changeatom_suffix: Less identifier Greater;
toatom_suffix: LeftBrace identifier RightBrace;
, it works.I think there maybe something wrong with antlr4 CPP runtime. I wonder why and how to fix it.
The following are my grammar and test code:
UniASTParser.g4
UniASRLexer.g4
test.cpp
test file
The text was updated successfully, but these errors were encountered: