diff --git a/Lex_Yacc/al.lex b/Lex_Yacc/al.lex index b935478..b0b1323 100644 --- a/Lex_Yacc/al.lex +++ b/Lex_Yacc/al.lex @@ -33,6 +33,7 @@ yyerror (char const *s) "GET" { return tGET; } "PRI" { return tPRI; } +"PRIC" { return tPRIC; } "CALL" { return tCALL; } "RET" { return tRET; } diff --git a/Lex_Yacc/as.y b/Lex_Yacc/as.y index 290fb93..a246b7e 100644 --- a/Lex_Yacc/as.y +++ b/Lex_Yacc/as.y @@ -11,7 +11,7 @@ %token tAFC tCPY tAFCA %token tREAD tWR %token tJMP tJMF -%token tGET tPRI +%token tGET tPRI tPRIC %token tCALL tRET %token tSTOP %token tNB @@ -55,6 +55,8 @@ Instruction : tWR tNB tNB {add_instruction(WRITE, $2, $3, 0);}; Instruction : tGET tNB {add_instruction(GET, $2, 0, 0);}; // PRI @ Instruction : tPRI tNB {add_instruction(PRI, $2, 0, 0);}; +// PRIC @ +Instruction : tPRIC tNB {add_instruction(PRIC, $2, 0, 0);}; // CALL Ins Val Instruction : tCALL tNB tNB {add_instruction(CALL, $2, $3, 0);}; diff --git a/Tables/tables.c b/Tables/tables.c index af30499..06ff8b6 100644 --- a/Tables/tables.c +++ b/Tables/tables.c @@ -187,10 +187,11 @@ void execute() { } } else if (programme[eip].instruction == GET) { - printf("Veuillez saisir un nombre : \n"); scanf("%d", &(mem[check_adresse(ebp + programme[eip].param1)])); } else if (programme[eip].instruction == PRI) { - printf("%d@%d\n", mem[check_adresse(ebp + programme[eip].param1)], ebp + programme[eip].param1); + printf("%d", mem[check_adresse(ebp + programme[eip].param1)]); + } else if (programme[eip].instruction == PRIC) { + printf("%c", mem[check_adresse(ebp + programme[eip].param1)]); } else if (programme[eip].instruction == CALL) { if (SECURISED) { diff --git a/Tables/tables.h b/Tables/tables.h index e193a33..e62ac96 100644 --- a/Tables/tables.h +++ b/Tables/tables.h @@ -3,7 +3,7 @@ // Enum of the instruction -enum instruction_t {ADD, MUL, SUB, DIV, INF, SUP, EQU, CPY, AFC, AFCA, READ, WRITE, JMP, JMF, PRI, GET, CALL, RET, STOP}; +enum instruction_t {ADD, MUL, SUB, DIV, INF, SUP, EQU, CPY, AFC, AFCA, READ, WRITE, JMP, JMF, PRI, PRIC, GET, CALL, RET, STOP}; // Add a new instruction void add_instruction(enum instruction_t inst, int param1, int param2, int param3);