Version fonctionnelle processeur sécurisé

This commit is contained in:
Paul Faure 2021-06-21 14:01:17 +02:00
parent c9c60001de
commit 725e012507

View file

@ -4,6 +4,7 @@
%{ %{
#include "../Tables/tables.h" #include "../Tables/tables.h"
#include <stdlib.h>
%} %}
%token tMUL tDIV tADD tSUB tINF tSUP tEQU %token tMUL tDIV tADD tSUB tINF tSUP tEQU
@ -65,7 +66,13 @@ Instruction : tSTOP tNB {add_instruction(STOP, $2, 0, 0);};
%% %%
int main(void) { int main(int argc, char * argv[]) {
if (argc != 2) {
printf("Specifiez le fichier à interpreter");
exit(2);
}
extern FILE * yyin;
yyin = fopen(argv[1], "r");
yyparse(); yyparse();
execute(); execute();
return 0; return 0;