6

I am developing a compiler for the real-time language PEARL with ANTLR4.

With ANTLR4 my ParseTree is populated with superflous tokens like e.g. semicolons for ending a grammatical unit.

Is there a way to tell ANTLR to ignore these kinds of token?

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268

1 Answers1

6

Is there a way to tell ANTLR to ignore these kind of tokens?

No, but using ANTLR4's built-in listener/visitor, there's no need to remove these tokens.

See: "skip" changes parser behavior

Community
  • 1
  • 1
Bart Kiers
  • 166,582
  • 36
  • 299
  • 288
  • Yes, with the current Visitor and Listener methods, doing nothing with the token is literally the same as ignoring it. – TomServo May 27 '17 at 12:28