Language now uses full grammar

This commit is contained in:
Daniel Holden
2013-09-27 10:41:42 +01:00
parent 3ccb23eb4c
commit 5a50398629
4 changed files with 87 additions and 69 deletions

View File

@@ -66,17 +66,10 @@ void test_language(void) {
expression : <product> (('+' | '-') <product>)*; \
product : <value> (('*' | '/') <value>)*; \
value : /[0-9]+/ | '(' <expression> ')'; \
maths : /^\\w*/ <expression> /\\w*$/; \
maths : /^/ <expression> /$/; \
",
Expr, Prod, Value, Maths);
/*
mpc_print(Expr);
mpc_print(Prod);
mpc_print(Value);
mpc_print(Maths);
*/
mpc_cleanup(4, Expr, Prod, Value, Maths);
}

View File

@@ -4,4 +4,4 @@ product : <value> (('*' | '/') <value>)*;
value : /[0-9]+/ | '(' <expression> ')';
maths : /^\\w*/ <expression> /\\w*$/;
maths : /^/ <expression> /$/;