diff --git a/src/a_pow_b.1 b/src/a_pow_b.1 index 1857b13..ba60490 100644 --- a/src/a_pow_b.1 +++ b/src/a_pow_b.1 @@ -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 diff --git a/src/ram.l b/src/ram.l index bc071f6..e9049c7 100644 --- a/src/ram.l +++ b/src/ram.l @@ -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();} %%