summaryrefslogtreecommitdiff
path: root/asm/asmpars.mly
diff options
context:
space:
mode:
Diffstat (limited to 'asm/asmpars.mly')
-rw-r--r--asm/asmpars.mly26
1 files changed, 13 insertions, 13 deletions
diff --git a/asm/asmpars.mly b/asm/asmpars.mly
index 8f47c91..4850c55 100644
--- a/asm/asmpars.mly
+++ b/asm/asmpars.mly
@@ -51,23 +51,23 @@ program:
lbls = !lbls2 } }
data:
- DATA d=datas* { d }
-
+ DATA d=datas* { d }
+
datas:
| labeld datas { () }
| BYTE n=INT { add ram n }
| WORD n=INT { 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 i=instr { i }
- | i=_instr { i }
-
+ | labeli i=instr { i }
+ | i=_instr { i }
+
_instr:
| o=ROP r1=REG r2=REG r3=REG { add pc 2; [R (o,r1,r2,r3)] }
| o=RIOP r1=REG r2=REG imm=imm
@@ -122,9 +122,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 }
@@ -133,9 +133,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 }