Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

antlr4: Ignore superflous tokens when creating ParseTrees

Tags:

antlr4

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?

like image 696
Marcel Schaible Avatar asked Mar 03 '13 10:03

Marcel Schaible


1 Answers

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

like image 153
Bart Kiers Avatar answered Dec 21 '22 23:12

Bart Kiers