11.4. New Parser Features

With the classes Sequence, Alternation, and Repetition, along with a hierarchy of Terminal classes, you can build an infinite variety of parsers. These classes form a complete toolkit, and so you could argue that they need never be extended. History has shown, however, that no toolkit is ever complete in the sense that it cannot profitably be extended. Toolkit developers should strive both for comprehensiveness and extensibility.

Software that is extensible has the following features:

  • Classes have short methods that perform a single service.

  • Methods and instance variables are generally protected rather than private, allowing subclasses more flexibility in how they extend a class.

  • Documentation is accurate and complete ...

Get Building Parsers with Java™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.