handle comments in assembly source file
This commit is contained in:
parent
ee34fc8d14
commit
bcb627f2b4
@ -1,11 +1,9 @@
|
||||
(2,4,5)
|
||||
ADD(i1,0,r0)
|
||||
ADD(i1,0,r1)
|
||||
ADD(i1,0,r2)
|
||||
ADD(1,0,r3)
|
||||
JE(i2,r3,4)
|
||||
MULT(r2,r0,r2)
|
||||
ADD(1,r3,r3)
|
||||
JUMP(-3)
|
||||
ADD(0,1,o0)
|
||||
ADD(r2,0,o1)
|
||||
ADD(i1,0,r0) // r0 temp value to calculate
|
||||
ADD(1,0,r1) // r1 loop counter
|
||||
JE(i2,r1,4) // loop control (r1 == b)
|
||||
MULT(i1,r0,r0) // r0 = r0*a
|
||||
ADD(1,r1,r1) // increment loop counter
|
||||
JUMP(-3) // loop
|
||||
ADD(0,1,o0) // output size in o0
|
||||
ADD(r0,0,o1) // o1 = a^b = i1^i2
|
||||
|
@ -16,7 +16,7 @@ ADD|SUB|MULT|DIV { yylval = strdup(yytext); return OP;}
|
||||
JUMP|JE|JL { yylval = strdup(yytext); return OP_CTRL;}
|
||||
[ ]*,[ ]* {return COMMA;}
|
||||
\( {return PAR_O;}
|
||||
\) {return PAR_C;}
|
||||
\)[ ]*("//".*)? {return PAR_C;}
|
||||
\n {return SEPARATION; }
|
||||
. {printf("token inconnu\n"); yyterminate();}
|
||||
%%
|
||||
|
Loading…
x
Reference in New Issue
Block a user