Search⌘ K
AI Features

ANTLR Parse Tree

Explore how ANTLR creates and uses parse trees in Java to process input phrases. Understand key classes like Lexer, Parser, ParseTree, and context objects representing grammar rules. Learn to work with generated parse-tree listeners and visitors to execute code on parsed input efficiently.

In order to make a language application, we must execute some appropriate code for each input phrase. We can do that by operating on the parse tree created by the parser automatically. As we operate on the tree, we are back in a familiar Java environment. 

ANTLR data structures and classes

To begin, we will examine the data structure and class names ANTLR uses for recognition and parsing. In the previous chapters on lexical and syntactic analysis, we ...