aboutsummaryrefslogtreecommitdiff
path: root/asm.peg
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-10 23:37:54 +1300
committerAndrew Chambers <[email protected]>2021-10-10 23:37:54 +1300
commit08dc724999e2d5616dc652a0d0d05b6edeecee02 (patch)
treec01c08d1551446b5d17a38ba6f9bfc30e0b82eba /asm.peg
parent157d4414e25132f99e0248ebe9a954236e6f50f7 (diff)
Add neg and c comments.
Diffstat (limited to 'asm.peg')
-rw-r--r--asm.peg11
1 files changed, 10 insertions, 1 deletions
diff --git a/asm.peg b/asm.peg
index e8cd805..1392fdd 100644
--- a/asm.peg
+++ b/asm.peg
@@ -4,7 +4,10 @@ line =
| eol { yy->v.kind = ASM_BLANK; }
| . { yy->v.kind = ASM_SYNTAX_ERROR; }
-ws = [ \t]+
+ws =
+ [ \t]+
+ | "/*" (! "*/" . )* "*/" # XXX multiline comments break our line numbers.
+
eol = ws? "\n"
stmt =
@@ -70,6 +73,7 @@ instr =
| i:lea { $$ = i; }
| i:mul { $$ = i; }
| i:imul { $$ = i; }
+ | i:neg { $$ = i; }
| i:movsx { $$ = i; }
| i:movzx { $$ = i; }
| i:mov { $$ = i; }
@@ -161,6 +165,11 @@ mul = "mul" (
| args:r-opargs { args.instr.variant += 4 ; $$ = args; }
) { $$.instr.kind = ASM_MUL; }
+neg = "neg" (
+ args:m-opargs { $$ = args; }
+ | args:r-opargs { args.instr.variant += 4 ; $$ = args; }
+) { $$.instr.kind = ASM_NEG; }
+
imul = "imul" (
(
'w'? ws s:m ws? ',' ws? d:r16 { $$ = INSTR2(8, s, d); }