aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2012-08-06 18:38:40 +0000
committerDimitri Sokolyuk <demon@dim13.org>2012-08-06 18:38:40 +0000
commit388349ef7a33f43c1912c9b5fc9dfead0632c66a (patch)
tree4ed8cecc754d0932d1771e53f579b92bc5f18929
parenta23412776f8c17333ac8884a8ec14fd50c3568f3 (diff)
add aliases for PUSH/POP/PEEK/PICK, fix negative literals
-rw-r--r--gramar.y16
1 files changed, 14 insertions, 2 deletions
diff --git a/gramar.y b/gramar.y
index 829cffd..c3f51bd 100644
--- a/gramar.y
+++ b/gramar.y
@@ -57,7 +57,7 @@ struct label {
%}
%union {
- int ival;
+ short ival;
char *sval;
};
@@ -149,9 +149,21 @@ operand
: register { $$ = $1; }
| LBR register RBR { $$ = 0x08 + $2; }
| PUSH { $$ = 0x18; }
+ | LBR MINUS MINUS SP RBR{ $$ = 0x18; }
| POP { $$ = 0x18; }
+ | LBR SP PLUS PLUS RBR { $$ = 0x18; }
| PEEK { $$ = 0x19; }
- | PICK { $$ = 0x1a; }
+ | LBR SP RBR { $$ = 0x19; }
+ | PICK expr
+ {
+ $$ = 0x1a;
+ push($2, NULL);
+ }
+ | LBR SP PLUS expr RBR
+ {
+ $$ = 0x1a;
+ push($4, NULL);
+ }
| SP { $$ = 0x1b; }
| PC { $$ = 0x1c; }
| EX { $$ = 0x1d; }