| Refresh | Home EGTry.com

token and rule labels to be used in rewrite


input string example

1 2 3 4


antlr grammar rewrite rules

grammar TreeConstruct;
options 
{
  output=AST;
}

prog 
: first=DIGIT other+=DIGIT*  -> ^($first $other*)
;

DIGIT: '0' .. '9' ;


WS: (' '|'\r'|'\n') {$channel=HIDDEN;};


output tree

(1 2 3 4)