University of Minnesota
Software Engineering Center

You are here

Context-Aware Scanning for Parsing Extensible Languages

Date of Publication: 
October 2007
Associated Research Groups: 
Publication Files: 
This paper introduces new parsing and context-aware scanning algorithms in which the scanner uses contextual information to disambiguate lexical syntax. The parser utilizes a slightly modified LR-style algorithm that passes to the scanner the set of valid symbols which the scanner may return at that point in parsing. This set is the terminal symbols that are valid for the current state, i.e., those whose entry in the parse table are shift, reduce, or accept, but not error. The scanner then only returns tokens in this set. Also, an analysis is given that can statically verify that the scanner will never return more than one token for a single input. Context-aware scanning is especially useful when parsing and scanning extensible languages in which domain specific languages can be embedded. We illustrate this approach with a declarative specification of a Java subset and extensions that embed SQL queries and Boolean expression tables into Java.
GPCE 2007 - Intl. Conference on Generative Programming and Component Engineering
@inproceedings{vanwyk07gpce, author = "Van Wyk, Eric and Schwerdfeger, August", title = "Context-Aware Scanning for Parsing Extensible Languages" booktitle = "Intl. Conf. on Generative Programming and Component Engineering, GPCE 2007", publisher = "{ACM} Press, month = "October", year = 2007 }