The Reuse of Grammars with Embedded Semantic Actions

  • Authors:
  • Terence Parr

  • Affiliations:
  • -

  • Venue:
  • ICPC '08 Proceedings of the 2008 The 16th IEEE International Conference on Program Comprehension
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Reusing syntax specifications without embedded arbitrary semantic actions is straightforward because the semantic analysis phases of new applications can feed off trees or other intermediate structures constructed by the pre-existing parser. The presence of arbitrary embedded semantic actions, however, makes reuse difficult with existing mechanisms such as grammar inheritance and modules. This short paper proposes a mechanism based upon prototype grammars that automatically pushes changes from prototypes to derived grammars even in the presence of semantic actions. The prototype mechanism alone would be unsuitable for creating a new grammar from multiple pre-existing grammars. When combined with grammar composition, however, the prototype mechanism would improve grammar reuse because imported pre-existing grammars could be altered to suit each new application.