Skip to content

Ejecución

Antes de ejecutar el compilador, se modifica el fichero input.txt para así probar el analizador sintáctico generado:

c
DATA
	float f1;
	int i1;
	float f2;
	int i2;

CODE

Si se ejecuta el compilador, como cabía esperar, no se notifican errores.

bash
Compiler started.

Compiler finished.

Sólo queda ver el fichero AST.html para comprobar los cambios producidos por la fase de gestión de memoria en el árbol:

Program =
|  varDefinitions List<VarDefinition> =
|  .  0: VarDefinition = . . . . . . . . . . . . . [2:8 2:10]    float f1;
|  .  |  type FloatType = . . . . . . . . . . . . .[null null]   
|  .  |  name = "f1" string
|  .  |  address = 0 int
|  .  1: VarDefinition = . . . . . . . . . . . . . [3:6 3:8]     int i1;
|  .  |  type IntType = . . . . . . . . . . . . . .[null null]   
|  .  |  name = "i1" string
|  .  |  address = 4 int
|  .  2: VarDefinition = . . . . . . . . . . . . . [4:8 4:10]    float f2;
|  .  |  type FloatType = . . . . . . . . . . . . .[null null]   
|  .  |  name = "f2" string
|  .  |  address = 6 int
|  .  3: VarDefinition = . . . . . . . . . . . . . [5:6 5:8]     int i2;
|  .  |  type IntType = . . . . . . . . . . . . . .[null null]   
|  .  |  name = "i2" string
|  .  |  address = 10 int
|  statements List<Statement> =

En el html anterior se puede ver, en color beige, los valores que ha tomado el atributo address en cada VarDefinition (0, 4, 6 y 10 respectivamente).