modifications interpreter

This commit is contained in:
Nahom 2021-04-29 11:36:06 +02:00
parent 0fa10f44a9
commit 7734aea2d2
6 changed files with 42 additions and 2 deletions

8
Interpreteur/src/.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

View file

@ -66,6 +66,9 @@ void asm_add_2(char ins, int arg1, int arg2) {
void asm_add_1(char ins, int arg1) {
asm_add_3(ins, arg1, 0, 0);
}
void asm_add_0(char ins) {
asm_add_3(ins, 0, 0, 0);
}
void asm_run() {
int ip = 0;

View file

@ -12,7 +12,7 @@
int nb;
}
%token tADD tMUL tSOU tDIV tCOP tAFC tJMP tJMF tINF tSUP tEQU tPRI tAFCA tWR tREAD
%token tADD tMUL tSOU tDIV tCOP tAFC tJMP tJMF tINF tSUP tEQU tPRI tAFCA tWR tREAD tCOPR tCALL tRET
%token <nb> tNB
@ -53,12 +53,19 @@ Instruction:
{asm_add_3(EQU, $2, $3, $4);}
| tPRI tNB
{asm_add_1(PRI, $2);}
| tAFCA tNB tNB
| tAFCA tNB tNB
{asm_add_2(AFCA, $2, $3);}
| tWR tNB tNB
{asm_add_2(WR, $2, $3);}
| tREAD tNB tNB
{asm_add_2(READ, $2, $3);}
| tCOPR tNB tNB
{asm_add_2(COPR, $2, $3);}
| tCALL tNB tNB tNB
{asm_add_3(READ, $2, $3, $4);}
| tRET
{asm_add_0(RET);}
;