Browse Source

Patch tableaux

Elies Tali 3 years ago
parent
commit
44a3e8b58f

+ 1
- 1
Documentation/transcription_opcodes.md View File

@@ -26,7 +26,7 @@ Copie le contenu de l'adresse @Y à l'adresse @X
26 26
 
27 27
 Copie la valeur val à l'adresse @X
28 28
 
29
-## AFCA @X @C
29
+## COPA @X @C
30 30
 
31 31
 Copie la valeur contenue dans @C à l'adresse @X en considérant que ce qui est copié est une adresse (et donc il faut ajouter BP)
32 32
 

+ 7
- 6
Lex_Yacc/as.y View File

@@ -41,7 +41,7 @@ int nbs_instructions_to_patch[10];
41 41
 %left tADD tSUB
42 42
 %left tMUL tDIV
43 43
 
44
-%type<nombre> E Invocation DebutAff SuiteAffPointeur DebutAffPointeur EBeforeAddr
44
+%type<nombre> E Invocation DebutAff SuiteAffPointeur DebutAffPointeur EBis ETer
45 45
 
46 46
 
47 47
 
@@ -132,12 +132,13 @@ E : tNOT E { printf("!\n"); };
132 132
 E : E tAND E {add_operation(MUL,$1,$1,$3); $$ = $1; decrement_temp_var();};
133 133
 E : E tOR E {add_operation(ADD,$1,$1,$3); $$ = $1; decrement_temp_var();} ;
134 134
 E : tMUL E { add_operation(READ, $2, $2, 0); $$=$2;};
135
-E : tADDR EBeforeAddr {add_operation(AFCA,$2, $2,0); $$=$2;};
136
-E : EBeforeAddr {$$=$1;};
135
+E : tADDR EBis {add_operation(COPA,$2, $2,0); $$=$2;};
136
+E : tADDR ETer {add_operation(COPA,$2, $2,0); $$=$2;};
137
+E : tID  tID { printf("Id\n"); struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(COP, addr,symbole->adresse,0); $$=addr;};
138
+E : tID tOCROCH E tCCROCH {struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(AFC, addr,symbole->adresse,0); int addr2 = allocate_mem_temp_var(INT); add_operation(AFC, addr2, taille_types[symbole->type.base],0); add_operation(MUL,$3,addr2,$3); add_operation(ADD,$3,addr,$3); add_operation(READ,$3,$3,0); $$=$3; decrement_temp_var(); decrement_temp_var();};
137 139
 
138
-
139
-EBeforeAddr : tID tOCROCH E tCCROCH {struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(AFC, addr,symbole->adresse,0); int addr2 = allocate_mem_temp_var(INT); add_operation(AFC, addr2, taille_types[symbole->type.base],0); add_operation(MUL,$3,addr2,$3); add_operation(ADD,$3,addr,$3); add_operation(READ,$3,$3,0); $$=$3; decrement_temp_var(); decrement_temp_var();};
140
-EBeforeAddr : tID { printf("Id\n"); struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(COP, addr,symbole->adresse,0); $$=addr;};
140
+EBis : tID tOCROCH E tCCROCH {struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(AFC, addr,symbole->adresse,0); int addr2 = allocate_mem_temp_var(INT); add_operation(AFC, addr2, taille_types[symbole->type.base],0); add_operation(MUL,$3,addr2,$3); add_operation(ADD,$3,addr,$3); $$=$3; decrement_temp_var(); decrement_temp_var();};
141
+ETer : tID { printf("Id\n"); struct symbole_t * symbole  = get_variable($1); int addr = allocate_mem_temp_var(symbole->type.base); add_operation(AFC, addr,symbole->adresse,0); $$=addr;};
141 142
 
142 143
 
143 144
 //Créer un champ isConst dans la table des symboles

+ 2
- 2
Tables/Instructions/tab_instruc.c View File

@@ -36,8 +36,8 @@ char * get_asm_line_from_op(struct operation_t op){
36 36
 		case (AFC):
37 37
 			sprintf(buffer,"AFC %d %d\n",op.arg1, op.arg2);
38 38
 			break;
39
-		case (AFCA):
40
-			sprintf(buffer,"AFCA %d %d\n",op.arg1, op.arg2);
39
+		case (COPA):
40
+			sprintf(buffer,"COPA %d %d\n",op.arg1, op.arg2);
41 41
 			break;
42 42
 		case (JMP):
43 43
 			sprintf(buffer,"JMP %d\n",op.arg1);

+ 1
- 1
Tables/Instructions/tab_instruc.h View File

@@ -4,7 +4,7 @@
4 4
 #include <stdio.h>
5 5
 
6 6
 
7
-enum opcode_t {ADD,MUL,SOU,DIV,COP,AFC,AFCA,JMP,JMF,INF,SUP,EQU,PRI,READ,WR};
7
+enum opcode_t {ADD,MUL,SOU,DIV,COP,AFC,COPA,JMP,JMF,INF,SUP,EQU,PRI,READ,WR};
8 8
 
9 9
 struct operation_t {
10 10
 	enum opcode_t opcode;

Loading…
Cancel
Save