Fix Typo in CMakeLists.
Add basic nonsense grammar.
This commit is contained in:
19
grammar/grammar.y
Normal file
19
grammar/grammar.y
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
%include {
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
%token_type {int}
|
||||||
|
|
||||||
|
%left PLUS MINUS.
|
||||||
|
|
||||||
|
%syntax_error {
|
||||||
|
std::cout << "Syntax error!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
program ::= expr. { }
|
||||||
|
|
||||||
|
expr ::= expr PLUS expr. { }
|
||||||
Reference in New Issue
Block a user