1

I am in the process of converting an antlr3 to antlr4 grammar. I have stripped out all the syntactic predicates. I am struggling to make a correct conversion of this

    relaxed_date_month_first
  : relaxed_day_of_week? relaxed_month COMMA? WHITE_SPACE relaxed_day_of_month (relaxed_year_prefix relaxed_year)?
      -> ^(EXPLICIT_DATE relaxed_day_of_month relaxed_month relaxed_day_of_week? relaxed_year?)

to antlr4 grammar.

Everytime the antlr4 tool runs into "->" character it says "extraneous input '->' expecting {TOKEN_REF, RULE_REF...ACTION}".

How do I fix this?

rusty bit
  • 371
  • 2
  • 17
Siya Mzam
  • 4,655
  • 1
  • 26
  • 44

1 Answers1

0

ANTLR4 has no tree-rewriting. So, remove -> ... entirely:

relaxed_date_month_first
 : relaxed_day_of_week? relaxed_month COMMA? WHITE_SPACE relaxed_day_of_month (relaxed_year_prefix relaxed_year)?
 ;
Bart Kiers
  • 166,582
  • 36
  • 299
  • 288