30 lines
No EOL
682 B
Markdown
30 lines
No EOL
682 B
Markdown
# Parser
|
|
## Explanation of options:
|
|
```cpp
|
|
// Bison version
|
|
%require "3.0.4"
|
|
|
|
// skeleton program to be used as parser
|
|
%skeleton "lalr1.cc"
|
|
|
|
// tells bison to generate a header file
|
|
%defines
|
|
|
|
// where the parser will live (in what namespace)
|
|
%define api.prefix {yy}
|
|
|
|
// the name of parser class
|
|
%define api.parser.class {Parser}
|
|
|
|
/* it will generate a location class which can be used in your lexer */
|
|
%locations
|
|
|
|
/* use the constructor for each token, and make_TOKENNAME functions will be generated */
|
|
%define api.token.constructor
|
|
|
|
/* use the variant type for $1~$n and $$ those variables */
|
|
%define api.value.type variant
|
|
|
|
%define parse.trace
|
|
%define parse.error verbose
|
|
``` |