12.3. Building Blocks

All the code for the engine described in this chapter lies within the package sjm.engine. In this package, there is no Engine class; instead, there are a few collaborating classes that together produce an engine. The essential classes that make up the engine are Structure, Variable, Rule, and Program. The classes Structure and Variable are the fundamental building blocks of the engine. Classes Program and Rule are aggregations; a Program object is an aggregation of Rule objects, and a Rule object is an aggregation of Structure objects. You'll visit all these classes, starting with the fundamentals shown in Figure 12.1.

Figure 12.1. Terms, structures, and variables. The classes Structure and Variable implement the Term interface. ...

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.