A parser is an object that recognizes the elements of a language and builds meaningful target objects based on the text it recognizes. To achieve this combination of recognition and building, this book uses a collaboration of three hierarchies of classes: Parser , Assembler , and Assembly . An assembly contains both the text to be recognized and work areas that house the results of work completed in building a result. Assemblers plug in to parsers and work on assemblies as the parsers recognize text. The Assembly hierarchy has two subclasses: one that provides individual characters as its elements and a second one that provides tokens. The Parser hierarchy has four main subclasses: Terminal , Sequence , Alternation , and Repetition . The Terminal class itself is at the top of a wide variety of subclasses. You need a Terminal subclass for each group of characters or tokens you want to recognize. You can compose new parsers as sequences, alternations , and repetitions of other parsers, creating an infinite variety of parsers from these few building blocks. |