Context-aware scanning for parsing extensible languages

Eric R. Van Wyk, August C. Schwerdfeger

Research output: Chapter in Book/Report/Conference proceedingConference contribution

60 Scopus citations

Abstract

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.

Original languageEnglish (US)
Title of host publicationGPCE'07 - Proceedings of the Sixth International Conference on Generative Programming and Component Engineering
Pages63-72
Number of pages10
DOIs
StatePublished - 2007
EventGPCE'07 - 6th International Conference on Generative Programming and Component Engineering - Salzburg, Australia
Duration: Oct 1 2007Oct 3 2007

Publication series

NameGPCE'07 - Proceedings of the Sixth International Conference on Generative Programming and Component Engineering

Other

OtherGPCE'07 - 6th International Conference on Generative Programming and Component Engineering
Country/TerritoryAustralia
CitySalzburg
Period10/1/0710/3/07

Keywords

  • Context-aware scanning
  • Extensible languages

Fingerprint

Dive into the research topics of 'Context-aware scanning for parsing extensible languages'. Together they form a unique fingerprint.

Cite this