About
From the grammar
- The lexer rules will create the lexer class
- The parser rules will create the parser class
The classes generated will contain a method for each rule in the grammar.
See example
Articles Related
Example
from the getting started with the below Hello grammar
grammar Hello;
r : 'hello' ID ;
ID : [a-z]+ ;
WS : [ \t\r\n]+ -> skip ;
- after installation of antlr
antlr4 Hello.g4
Next to the grammar file, you got:
- the listener HelloListener.java - to traverse the tree
ls -A1
Hello.g4
Hello.interp
Hello.tokens
HelloBaseListener.java
HelloLexer.interp
HelloLexer.java
HelloLexer.tokens
HelloListener.java
HelloParser.java