What does the & # 8594; operator mean? in ANTLR3?

I am trying to compile a grammar and make it work in ANTLR4. Grammar was written for ANTLR3, and I get a lot of compilation errors. Here is one of them:

syntax error: '->' came as a complete surprise to me while looking for rule element

This rule causes an error.

tokens {
  ZONE;
  ZONE_OFFSET; 
}

time_zone_abbreviation
  : UTC  -> ZONE["UTC"]
  | EST  -> ZONE["America/New_York"]
  | CST  -> ZONE["America/Chicago"]
  | PST  -> ZONE["America/Los_Angeles"]
  | MST  -> ZONE["America/Denver"]
  | AKST -> ZONE["America/Anchorage"]
  | HAST -> ZONE["Pacific/Honolulu"]
  ;

I know that a statement ->can be used to specify the lexer command in ANTLR4. But what does the operator mean in ANTLR3?

+3
source share
1 answer

Within parser rules, ->denotes a rewrite rule in ANTLR 3, which builds an AST from a parser rule. Read more about this in this Q & A: How to derive an AST constructed using ANTLR?

ANTLR 4 -> lexer, ( ). ANTLR 4 AST, -> . ANTLR v3 v4 -> .

+4

All Articles