From 40a25681423e8db690398a9db31b958ec70b70e9 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 27 Oct 2013 17:24:44 +0900 Subject: [PATCH] read multiple expressions; read exprs are wrapped in a begin --- src/parse.y | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/parse.y b/src/parse.y index 6e62b2c6..4b46dae6 100644 --- a/src/parse.y +++ b/src/parse.y @@ -37,23 +37,40 @@ void yylex_destroy(); %token tQUOTE tQUASIQUOTE tUNQUOTE tUNQUOTE_SPLICING %token tSYMBOL tNUMBER tBOOLEAN tSTRING +%type program_data %type datum simple_datum compound_datum abbrev %type list list_data %% program - : datum + : program_data { - p->value = $1; + p->value = pic_cons(p->pic, p->pic->sBEGIN, $1); } - | incomplete_datum + | incomplete_program_data { p->incomp = true; p->value = pic_undef_value(); } ; +program_data + : datum + { + $$ = pic_cons(p->pic, $1, pic_nil_value()); + } + | datum program_data + { + $$ = pic_cons(p->pic, $1, $2); + } +; + +incomplete_program_data + : incomplete_datum + | datum incomplete_program_data +; + datum : simple_datum | compound_datum