passing first test
This commit is contained in:
parent
1ce662294b
commit
9c493f543a
3 changed files with 19 additions and 11 deletions
12
src/parser.y
12
src/parser.y
|
|
@ -24,9 +24,11 @@
|
|||
|
||||
%parse-param { Scanner* scanner }
|
||||
|
||||
%token <std::string> WORD
|
||||
%token NUMBER
|
||||
%token CHAR
|
||||
%token <std::string> IDENTIFIER
|
||||
%token <std::string> STRING
|
||||
%token <int> NUMBER
|
||||
%token EQUALS NEWLINE PLUS MINUS EOF
|
||||
|
||||
|
||||
%%
|
||||
input:
|
||||
|
|
@ -35,9 +37,7 @@ input:
|
|||
;
|
||||
|
||||
element:
|
||||
WORD { std::cout << "WORD: " << $1 << "\n"; }
|
||||
| NUMBER { std::cout << "NUMBER\n"; }
|
||||
| CHAR { std::cout << "CHAR\n"; }
|
||||
IDENTIFIER { std::cout << "IDENTIFIER: " << $1 << "\n"; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue