Letâs Get Meta!
To implement a language, we have to build an application that reads sentences and reacts appropriately to the phrases and input symbols it discovers. (A language is a set of valid sentences, a sentence is made up of phrases, and a phrase is made up of subphrases and vocabulary symbols.) Broadly speaking, if an application computes or âexecutesâ sentences, we call that application an interpreter. Examples include calculators, configuration file readers, and Python interpreters. If weâre converting sentences from one language to another, we call that application a translator. Examples include Java to C# converters and compilers.
To react appropriately, the interpreter or translator has to recognize all of the valid sentences, ...
Get The Definitive ANTLR 4 Reference, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.