TY - GEN
T1 - Context-aware scanning for parsing extensible languages
AU - Van Wyk, Eric
AU - Schwerdfeger, August C.
PY - 2007
Y1 - 2007
N2 - This paper introduces new parsing and context-aware scanning algorithms in which the scanner uses contextual information to disambiguate lexical syntax. The parser uses a slightly modified LR-style algorithm that passes to the scanner the set of valid symbols that the scanner may return at that point in parsing. This set is those terminals whose entries in the parse table for the current parse state are shift, reduce, or accept, but not error. The scanner then only returns tokens in this set. 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. It has been used in extensible versions of Java 1.4 and ANSI C. We illustrate this approach with a declarative specification of a subset of Java and extensions that embed SQL queries and Boolean expression tables into Java.
AB - This paper introduces new parsing and context-aware scanning algorithms in which the scanner uses contextual information to disambiguate lexical syntax. The parser uses a slightly modified LR-style algorithm that passes to the scanner the set of valid symbols that the scanner may return at that point in parsing. This set is those terminals whose entries in the parse table for the current parse state are shift, reduce, or accept, but not error. The scanner then only returns tokens in this set. 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. It has been used in extensible versions of Java 1.4 and ANSI C. We illustrate this approach with a declarative specification of a subset of Java and extensions that embed SQL queries and Boolean expression tables into Java.
KW - Context-aware scanning
KW - Extensible languages
UR - http://www.scopus.com/inward/record.url?scp=38849168071&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=38849168071&partnerID=8YFLogxK
U2 - 10.1145/1289971.1289983
DO - 10.1145/1289971.1289983
M3 - Conference contribution
AN - SCOPUS:38849168071
SN - 9781595938558
T3 - GPCE'07 - Proceedings of the Sixth International Conference on Generative Programming and Component Engineering
SP - 63
EP - 72
BT - GPCE'07 - Proceedings of the Sixth International Conference on Generative Programming and Component Engineering
T2 - GPCE'07 - 6th International Conference on Generative Programming and Component Engineering
Y2 - 1 October 2007 through 3 October 2007
ER -