aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2012-08-06 18:55:49 +0000
committerDimitri Sokolyuk <demon@dim13.org>2012-08-06 18:55:49 +0000
commitdd2d56fd3ba069162189e4a26418edaf65064d55 (patch)
tree6e0e1550c2e3491c37929706270fab4fe0effa79
parent388349ef7a33f43c1912c9b5fc9dfead0632c66a (diff)
add two new tockens
-rw-r--r--gramar.y6
-rw-r--r--lexer.l2
2 files changed, 5 insertions, 3 deletions
diff --git a/gramar.y b/gramar.y
index c3f51bd..83e4452 100644
--- a/gramar.y
+++ b/gramar.y
@@ -70,7 +70,7 @@ struct label {
%token NOP BRK DAT ORG
%token JSR HCF INT IAG IAS RFI IAQ HWN HWQ HWI
%token LBR RBR LBRACE RBRACE LPAR RPAR
-%token COMMA DP
+%token COMMA DP INCR DECR
%token PLUS MINUS EMUL EDIV EMOD ENOT EXOR EAND EOR SHIFTL SHIFTR
%token DOT HASH MACRO INCLUDE
%token <ival> NUMBER
@@ -149,9 +149,9 @@ operand
: register { $$ = $1; }
| LBR register RBR { $$ = 0x08 + $2; }
| PUSH { $$ = 0x18; }
- | LBR MINUS MINUS SP RBR{ $$ = 0x18; }
+ | LBR DECR SP RBR { $$ = 0x18; }
| POP { $$ = 0x18; }
- | LBR SP PLUS PLUS RBR { $$ = 0x18; }
+ | LBR SP INCR RBR { $$ = 0x18; }
| PEEK { $$ = 0x19; }
| LBR SP RBR { $$ = 0x19; }
| PICK expr
diff --git a/lexer.l b/lexer.l
index d738d4b..d891567 100644
--- a/lexer.l
+++ b/lexer.l
@@ -98,7 +98,9 @@ DEC [0-9]+
[Ii] return I;
[Jj] return J;
+"++" return INCR;
"+" return PLUS;
+"--" return DECR;
"-" return MINUS;
"*" return EMUL;
"/" return EDIV;