Tear-Insert-Fold grammars

  • Authors:
  • Adrian Johnstone;Elizabeth Scott

  • Affiliations:
  • Royal Holloway, University of London, Egham, Surrey, UK;University of London, Egham, Surrey, UK

  • Venue:
  • Proceedings of the Tenth Workshop on Language Descriptions, Tools and Applications
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Context Free Grammars (CFGs) are simple and powerful formalisms for defining languages (sets of strings) whose semantics are specified hierarchically --- the meaning of a string is determined by terminals and the meanings of substrings. This hierarchy is captured in the derivation tree corresponding to the string. Derivation trees usually contain more structure than is strictly required to determine the semantics of the string so in practice a simplified or abstract syntax tree is used as an internal representation of a concrete text. Indeed, much of the work of a compiler or source-source translator may be described in terms of stepwise transformation of such trees, culminating in a final traversal during which the translated text is output. This paper introduces Tear-Insert-Fold grammars which add tree-manipulation annotations to standard CFGs. These annotations allow typical abstract forms to be constructed directly from the grammar for the concrete syntax and provide a convenient and concise specification of the relationship between the set of derivation trees and the set of abstract trees for a parser. More significantly, for any TIF grammar Γ0 there is a TIF grammar Γ1 whose derivation trees are the abstract trees produced by Γ0.