3.3. Designing Assemblers

One way to get a grip on the design of your parser is to think about how you will build the result you want from the text you recognize. So one way to get started with the design of a new parser is to start designing your assemblers.

3.3.1. The Collaboration of Parsers, Assemblers, and Assemblies

An assembly provides both a stack and a target object for the parser's assemblers to work on. The target object is like a sculpture, taking form as the parser recognizes the input text. Figure 3.1 shows the Parser, Assembler, and Assembly classes, which collaborate to sculpt text into a result.

Figure 3.1. The Parser, Assembler, and Assembly classes. Each parser in a parser composite tries to match against the assembly, and ...

Get Building Parsers with Java™ 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.