0 references
Using yacc and lex with C++
ACM SIGPLAN Notices1994Vol. 29(12), pp. 94–103
Abstract
We consider one approach to using C++ to write a compiler in combination with the lexical analysis tool Lex and the parser generator tool YACC. This approach uses C++ classes and constructors to build a syntax tree during the parse. Synthesized and inherited attributes are easy to declare for individual terminals and nonterminals, and synthesized attributes can be computed during the parse as long as no inherited attributes are involved in the computation. We also consider the use of virtual functions for tree traversal. A complete example YACC specification is included which demonstrates these techniques. Results show that C++ offers several advantages over C for compiler design with YACC and Lex.
Related Papers
- → In-Order Transition-based Constituent Parsing(2017)73 cited
- → In-Order Transition-based Constituent Parsing(2017)1 cited
- → Syntax Analysis: The Left-Most-Derivation-and-Reduction Trees and its Compare with the LR Parsing Methods(2014)
- A Method for Parsing GCC abstract Syntax Tree(2004)
- → Parse Trees(2019)