- should write verbatim code for the parser implementation. For C/C++, it
- replaces the traditional Yacc prologue, `%{CODE%}', for most purposes.
- For Java, it inserts your CODE into the parser class. Compare with:
-
- - `%{CODE%}' appearing after the first `%union {CODE}' in a C/C++
- based grammar file. While Bison will continue to support `%{CODE%}'
- for backward compatibility, `%code {CODE}' is cleaner as its
- functionality does not depend on its position in the grammar file
- relative to any `%union {CODE}'. Specifically, `%code {CODE}'
- always inserts your CODE into the parser code file after the usual
- contents of the parser header file.
+ should write verbatim code for the parser implementation. It replaces
+ the traditional Yacc prologue, `%{CODE%}', for most purposes. Compare
+ with:
+
+ - `%{CODE%}' appearing after the first `%union {CODE}' in a grammar
+ file. While Bison will continue to support `%{CODE%}' for backward
+ compatibility, `%code {CODE}' is cleaner as its functionality does
+ not depend on its position in the grammar file relative to any
+ `%union {CODE}'. Specifically, `%code {CODE}' always inserts your
+ CODE into the parser code file after the usual contents of the
+ parser header file.