summaryrefslogtreecommitdiff
path: root/asm/asmpars.mly
diff options
context:
space:
mode:
Diffstat (limited to 'asm/asmpars.mly')
-rw-r--r--asm/asmpars.mly18
1 files changed, 9 insertions, 9 deletions
diff --git a/asm/asmpars.mly b/asm/asmpars.mly
index e568127..c48c9ce 100644
--- a/asm/asmpars.mly
+++ b/asm/asmpars.mly
@@ -53,7 +53,7 @@
%%
program:
- TEXT NLB* is=instr* data? EOF
+ NLB* TEXT NLB* is=instr* data? EOF
{ { text = List.flatten is;
lbls = !lbls2 } }
@@ -66,10 +66,10 @@ datas:
| WORD n=INT NLB+ { add ram (2*n) }
labeli:
- id=ID COLON { lbls2 := Imap.add id (!pc,true) !lbls2 }
+ id=ID COLON { lbls2 := Imap.add id (!pc,true) !lbls2 }
labeld:
- id=ID COLON { lbls2 := Imap.add id (!ram,false) !lbls2 }
+ id=ID COLON { lbls2 := Imap.add id (!ram,false) !lbls2 }
instr:
| labeli NLB* i=instr { i }
@@ -129,9 +129,9 @@ _instr:
| MOVE r1=REG r2=REG { add pc 2; [R (Add,r1,r2,0)] }
| NOT r1=REG r2=REG { add pc 2; [R (Nor,r1,r2,0)] }
| JZ r=REG l=ID { let l = li false 5 (Lab l) in
- add pc 2; l @ [R (Jer,r,5,0)] }
+ add pc 2; l @ [R (Jer,5,r,0)] }
| JNZ r=REG l=ID { let l = li false 5 (Lab l) in
- add pc 2; l @ [R (Jner,r,5,0)] }
+ add pc 2; l @ [R (Jner,5,r,0)] }
| POP r=REG { add pc 4; [Lw (r,7,0); Incri (7,2)] }
| PUSH r=REG { add pc 4; [Incri (7,-2); Sw (r,7,0)] }
| BYTE bs=int+ { List.map (fun b -> add pc 1; Byte b) bs }
@@ -140,9 +140,9 @@ _instr:
| ASCII s=STR { List.map (fun c -> add pc 1; Byte (Char.code c)) s }
imm:
- | id=ID { Lab id }
- | n=int { Imm n }
+ | id=ID { Lab id }
+ | n=int { Imm n }
int:
- | n=INT { n }
- | MINUS n=INT { - n }
+ | n=INT { n }
+ | MINUS n=INT { - n }