2.8 Summary

Building Parsers with Java
By Steven  John  Metsker

Table of Contents
Chapter  2.   The Elements of a Parser


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.


Building Parsers with Java
Building Parsers With Javaв„ў
ISBN: 0201719622
EAN: 2147483647
Year: 2000
Pages: 169

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net