Modular grammar specification

Adrian Johnstone, Elizabeth Scott, Mark van den Brand

Research output: Contribution to journalArticlepeer-review

356 Downloads (Pure)

Abstract

We establish a semantics for building grammars from a modularised speci-
cation in which modules are able to delete productions from imported nonterminals.
Our goal is to allow a precise answer to the question: `what character
level language does this grammar generate' in the face of dicult issues such
as the mutual embedding of languages that have dierent whitespace and
commenting conventions. Our technique is to automatically generate a character
level grammar from grammars written at token level in the conventional
way; the grammar is constructed from modules each of which may have its
own whitespace convention. Modules have import lists of nonterminals; some
or all of an imported nonterminal's productions may be suppressed at import
time. There are two basic import mechanisms which (a) reference or
(b) clone an imported nonterminal's productions. We conclude with a set
of examples using the concrete syntax from our ART GLL parser generator
tool.
Original languageEnglish
Pages (from-to)23-43
Number of pages21
JournalScience of Computer Programming
Volume87
Early online date1 Oct 2013
DOIs
Publication statusPublished - 1 Jul 2014

Keywords

  • Context Free Grammar, Modularity, Whitespace processing

Cite this