Gestión de Memoria
Especificación de la etapa de gestión de memoria (perteneciente a la fase de generación de código) utilizando como metalenguaje una gramática atribuida:
Attributes
Symbol | Atribute Name | Java Type | Syn/Inh | Description |
varDefinition | address | int | Inherited | Variable address |
Auxiliary Functions
Name | Description |
size(type) | Type size in bytes |
Rules
Node | Predicates | Functions |
program → varDefinition* statement* | varDefinitioni.address = ∑size(varDefinitionj.type) | 0 ≤ j < i | |
varDefinition → type name:string | ||
intType:type → ε | ||
floatType:type → ε | ||
print:statement → expression | ||
assignment:statement → left:expression right:expression | ||
arithmetic:expression → left:expression operator:string right:expression | ||
variable:expression → name:string | ||
intLiteral:expression → intValue:int | ||
floatLiteral:expression → floatValue:float |