Skip to content

Commit

Permalink
Make del a regular statement rather than only a top-level operation
Browse files Browse the repository at this point in the history
Now that del generates code to delete stuff at runtime, it needs to be
a regular statement that can be included in functions rather than only
operating at the top level

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 7, 2019
1 parent 8632b67 commit 3103147
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions snek-gram.ll
Expand Up @@ -54,22 +54,8 @@ command : @{ snek_print_val = snek_interactive; }@ stat
if (ref)
*ref = poly;
}@
| DEL del dels-p
| IMPORT NAME
;
dels-p : COMMA del
dels-p
|
;
del : expr-array
@{
snek_token_val.op = snek_op_del;
goto extract_lvalue;
}@
@{
goto add_op_lvalue;
}@
;
opt-formals : formals
|
;
Expand Down Expand Up @@ -112,6 +98,20 @@ small-stat : assign-expr
@{ snek_code_add_forward(snek_forward_continue); }@
| PASS
| GLOBAL globals
| DEL del dels-p
;
dels-p : COMMA del
dels-p
|
;
del : expr-array
@{
snek_token_val.op = snek_op_del;
goto extract_lvalue;
}@
@{
goto add_op_lvalue;
}@
;
ret-expr : expr
|
Expand Down

0 comments on commit 3103147

Please sign in to comment.