1

I had the following code in ANTLR3:

grammar XL;

options {
    language = Java;
    output = AST;
    ASTLabelType = CommonTree;
}

tokens {
    MINUS;
}


evaluator
    :   (variable_assignment | expression)* EOF!
    ;

variable_assignment
    :   ID '='^ expression ;!
    ;

...

I am trying to migrate the code into ANTLR4, which seems to have a significantly different syntax... I've looked at ANTLR4 documentation, but could not find the equivalent of ^ (for making something the parent node of Abstract Syntax Tree) and ! signs in ANTLR 4.

Also, the lines "output = AST;" and "ASTLabelType = CommonTree;" seem to be unsupported in ANTLR4.. These differences between ANTLR3 and ANTLR4 are really confusing.. Can someone help he with this issue?

user2436815
  • 3,455
  • 5
  • 27
  • 40

0 Answers0