Fixed error with failure messages. Null terminated lists to mpca_lang and fixed crash.

This commit is contained in:
Daniel Holden
2014-04-23 12:20:20 +01:00
parent 60b1496bb5
commit a5ed2097ea
6 changed files with 13 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ int main(int argc, char **argv) {
" noun : \"lisp\" | \"language\" | \"c\" | \"book\" | \"build\"; "
" phrase : <adjective> <noun>; "
" doge : /^/ <phrase>* /$/; ",
Adjective, Noun, Phrase, Doge);
Adjective, Noun, Phrase, Doge, NULL);
if (argc > 1) {

View File

@@ -21,7 +21,7 @@ int main(int argc, char **argv) {
" expr : <number> | <symbol> | <string> "
" | <comment> | <sexpr> | <qexpr> ; "
" lispy : /^/ <expr>* /$/ ; ",
Number, Symbol, String, Comment, Sexpr, Qexpr, Expr, Lispy);
Number, Symbol, String, Comment, Sexpr, Qexpr, Expr, Lispy, NULL);
if (argc > 1) {

View File

@@ -12,7 +12,12 @@ int main(int argc, char **argv) {
" product : <value> (('*' | '/') <value>)*; "
" value : /[0-9]+/ | '(' <expression> ')'; "
" maths : /^/ <expression> /$/; ",
Expr, Prod, Value, Maths);
Expr, Prod, Value, Maths, NULL);
mpc_print(Expr);
mpc_print(Prod);
mpc_print(Value);
mpc_print(Maths);
if (argc > 1) {

View File

@@ -60,7 +60,7 @@ int main(int argc, char **argv) {
" includes : (\"#include\" <string>)* ; \n"
" smallc : /^/ <includes> <decls> <procedure>* <main> /$/ ; \n",
Ident, Number, Character, String, Factor, Term, Lexp, Stmt, Exp,
Typeident, Decls, Args, Body, Procedure, Main, Includes, Smallc);
Typeident, Decls, Args, Body, Procedure, Main, Includes, Smallc, NULL);
if (err != NULL) {
mpc_err_print(err);