Is there a concise description of the set of grammars that are accepted by the ANTLR4 tool ? #4955
|
I'm in the process of porting the (Python) ANTLR4 runtime to OCaml; I'm porting it in a manner that should ensure bug-for-bug compatibility with the Python runtime, as I'm running all the existing tests in the runtime-testsuite. I notice that there is no similar testsuite for the tool ? I'd like in the end to clone the tool in OCaml, so such a test suite (or even a textual description of what grammars are accepted) would be useful. Does anybody know if such a thing exists? The tests in the tool-testsuite don't appear to be the thing I describe above. What would be nice, is a collection of tests somewhat like the runtime-testsuite, where each is a grammar plus whatever indications for special invocation, and then either it passes or (more important case) the error-message that is produced by the tool when it rejects. I've some visualization of the ATNs produced by the tool, and they're pretty simple, so perhaps the answer is "any grammar that is syntactically valid, and for which an ATN can be generated, is accepted" ?? Any advice appreciated. ETA: by "concise", I think I mean "more concise than the source code of the tool." Of course, in the end if there's nothing, I'm perfectly OK with just diving into the tool source code and figuring it out. |
Replies: 1 comment 5 replies
|
The best test suite for end-to-end testing of an Antlr4 grammar is the grammars-v4 repo, which contains 359 grammars and in;puts. Of the grammars with actions/predicates, almost all are in target-agnostic format, which allows the grammar to be used for all targets. Most tests are for valid input, but there are also some invalid-input tests. |
The best test suite for end-to-end testing of an Antlr4 grammar is the grammars-v4 repo, which contains 359 grammars and in;puts. Of the grammars with actions/predicates, almost all are in target-agnostic format, which allows the grammar to be used for all targets. Most tests are for valid input, but there are also some invalid-input tests.