Skip to content
Advertisement

Tag: abstract-syntax-tree

ANTLR AST visitor that returns different data types

I finished converting the ANTLR CST into an AST and created a specific Visitor<T> interface that allows me to visit all my AST nodes, but the main issue i’m having is that some visits should return different data types, and i’m not sure how to go about this. For example, for simple arithmetics operations i want to return a double

Can Antlr ignore some of the keyword?

I’m new to Antlr but I’m trying to change some of the Grammar from my existing project. The example of the grammar looks like this The grammar is supposed to parse something like this a=10 AND s=1 AND s=2 or ((a=9 AND s=1) AND s=2). The question is is it possible to ignore anything that’s not s={ANYTHING}. So from the

Advertisement