grammars-v4
grammars-v4 copied to clipboard
Changes in C grammar
Added compilable file all_in_one.c, java test program Changed grammar is tested
I have several questions and comments.
-
What Github Issue is this in reference to?
-
Why are you including a Java test program when there are already driver programs generated for each of the targets (CSharp, Java, Cpp, Dart, Go, PHP, Python3, JavaScript) for testing?
- For basic testing, try "mvn test" from an Ubuntu virtual machine (hosted on Windows).
- For targets other than Java, try "cd c; bash ../_scripts/regtest.sh CSharp". You will need to set up your environment--again best on an Ubuntu virtual machine. To see how the builds work, look at the Github Actions workflow file.
-
Do not include anything other than C test files in the
examples/directory (fileexamples/makefileis being parsed as C). There's no restrictions on what suffix (aka extension) to use on a file as they are all considered input files. The exception are files that end in ".tree" and ".errors". Test files should be post C-preprocessor C code as there is no pre-processor step in the testing. However, the grammar does "swallow" the "#" directives as a convenience.2022-03-20T18:06:49.6325029Z --- Testing file /home/runner/work/grammars- v4/grammars-v4/c/examples/makefile --- 2022-03-20T18:06:49.7652553Z line 5:1 token recognition error at: '$' 2022-03-20T18:06:49.7655062Z line 1:2 no viable alternative at input 'CC=' 2022-03-20T18:06:49.7666602Z line 2:11 no viable alternative at input '-I.-' 2022-03-20T18:06:49.7699594Z Parse failed.
-
error(134): C.g4:514:0: symbol function conflicts with generated code in target language or runtime This means that parser rule symbol "function" in the grammar is a symbol name that you cannot use in a particular target. Normally we rename the symbol with an underscore appended to avoid the problem. "function" => "function_". (Note, in the next version of Antlr, v4.10, the symbol conflict restriction will be removed.)
@borneq are you planning to continue with this PR?
@borneq thanks for this PR. It has been open since March 20, 2022 and I am therefore closing it. You are welcome to re-open it or resubmit the changes under a new PR.