Chapter 5Designing Grammars
In Part I, we got acquainted with ANTLR and saw a high-level view of grammars and language applications. Now we’re going to slow down and learn the details needed to perform useful tasks such as building internal data structures, extracting information, and generating a translation of the input. The first step on our journey, though, is to learn how to build grammars. In this chapter, we’ll look at the most commonly used lexical and syntactic language structures and figure out how to express them in ANTLR notation. Armed with these ANTLR building blocks, we’ll combine them to build some real grammars in the next chapter.
To learn how to build grammars, we can’t just wade through the various ANTLR constructs. First, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access