diff --git a/exercises/02/vslc/src/parser.y b/exercises/02/vslc/src/parser.y index f72326e..e29cbad 100644 --- a/exercises/02/vslc/src/parser.y +++ b/exercises/02/vslc/src/parser.y @@ -11,7 +11,11 @@ %nonassoc UMINUS %right '~' +%nonassoc IF THEN +%nonassoc ELSE + %% + program: global_list { node_init(root = malloc(sizeof(node_t)), PROGRAM, NULL, 1, $1); @@ -94,8 +98,8 @@ declaration_list: declaration { node_init($$ = malloc(sizeof(node_t)), DECLARATION_LIST, NULL, 1, $1); } - | declaration_list ',' declaration { - node_init($$ = malloc(sizeof(node_t)), DECLARATION_LIST, NULL, 2, $1, $3); + | declaration_list declaration { + node_init($$ = malloc(sizeof(node_t)), DECLARATION_LIST, NULL, 2, $1, $2); } ;