read multiple expressions; read exprs are wrapped in a begin

This commit is contained in:
Yuichi Nishiwaki 2013-10-27 17:24:44 +09:00
parent 14dcb63c33
commit 40a2568142
1 changed files with 20 additions and 3 deletions

View File

@ -37,23 +37,40 @@ void yylex_destroy();
%token tQUOTE tQUASIQUOTE tUNQUOTE tUNQUOTE_SPLICING %token tQUOTE tQUASIQUOTE tUNQUOTE tUNQUOTE_SPLICING
%token <datum> tSYMBOL tNUMBER tBOOLEAN tSTRING %token <datum> tSYMBOL tNUMBER tBOOLEAN tSTRING
%type <datum> program_data
%type <datum> datum simple_datum compound_datum abbrev %type <datum> datum simple_datum compound_datum abbrev
%type <datum> list list_data %type <datum> list list_data
%% %%
program 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->incomp = true;
p->value = pic_undef_value(); 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 datum
: simple_datum : simple_datum
| compound_datum | compound_datum