Sciweavers

SIGCSE
2005
ACM

Design patterns for parsing

14 years 5 months ago
Design patterns for parsing
We provide a systematic transformation of an LL(1) grammar to an object model that consists of · an object structure representing the non-terminal symbols and their corresponding grammar production rules, · a union of classes representing the terminal symbols (tokens). We present a variant form of the visitor pattern and apply it to the above union of token classes to model a predictive recursive descent parser on the given grammar. Parsing a non-terminal is represented by a visitor to the tokens. For non-terminals that have more than one production rule, the corresponding visitors are chained together according to the chain of responsibility pattern in be processed correctly by a valid token. The abstract factory pattern, where each concrete factory corresponds to a nonterminal symbol, is used to manufacture appropriate parsing visitors. Our object-oriented formulation for predictive recursive descent parsing eliminates the traditional construction of the predictive parsing table a...
Dung Zung Nguyen, Mathias Ricken, Stephen B. Wong
Added 26 Jun 2010
Updated 26 Jun 2010
Type Conference
Year 2005
Where SIGCSE
Authors Dung Zung Nguyen, Mathias Ricken, Stephen B. Wong
Comments (0)