March 2001
Intermediate to advanced
400 pages
8h 35m
English
If your parser needs a special tokenizer or target, you can create a new subclass of ParserTester and override the assembly() and freshTarget() methods. For example, the SlingParser class in Chapter 16, “Parsing an Imperative Language,” uses a special tokenizer that recognizes reserved words. This parser class also requires an assembly to have as its target a SlingTarget object. To provide for these special target and tokenization needs, the class SlingTester in sjm.examples.sling overrides the freshTarget() and assembly() methods of its superclasses. Here is SlingTester.java:
package sjm.examples.sling; import sjm.parse.*; import sjm.parse.tokens.*; import sjm.examples.sling.*; /** * This class tests that ...
Read now
Unlock full access