Abstract

AbstractSome 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.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.