Preprocessing embedded actions

Research output: Contribution to journalArticle

Abstract

Some parser generators allow the user to attach actions, consisting of executable code, to syntax rules. Actions are usually in the local programming language, so they are simply copied into the generated parser. However, we show two situations in which it is convenient to allow actions to be in a different notation. A preprocessor is used to translate such notations into the local programming language. A preprocessor must know where to find actions and how to translate them. We show how these two activities can be programmed separately. Often, the user only has to worry about the second part: once the parser generator is known, the placement of the actions is known as well, so routines for finding actions can be separately compiled and linked in. Examples in the paper are based on the parser generator Yacc, but the approach is not limited to Yacc, or even to parser generators. Certain compositions of syntax‐directed translations can be implemented by preprocessing actions.

Original languageEnglish (US)
Pages (from-to)291-297
Number of pages7
JournalSoftware: Practice and Experience
Volume14
Issue number3
DOIs
StatePublished - Mar 1984
Externally publishedYes

Keywords

  • Parser generators
  • Parsing actions
  • Yacc

ASJC Scopus subject areas

  • Software

Fingerprint Dive into the research topics of 'Preprocessing embedded actions'. Together they form a unique fingerprint.

  • Cite this