module Declaration: sig
.. end
Here are all the functions used to generate the declaration table
Here are all the functions used to generate the declaration table
val genBtype : int ->
int ->
Syntaxtree.bType ->
Intermediate.intermediateCode -> bool -> int * int * Intermediate.element
Used to create a single variable entry on the dec_table
Returns The entry which is binded into the Hashtable
idx
: The index of the variable (1 for single variables, the vector index for Vector or Matrix)
dim
: The dimension of a line (1 for single variable, the number of columns for Vector or Matrix)
bt
: The Basic type of the variable (int or float)
ic
: The instance of the IntermediateCode class
b
: True if the variable is declared into a subroutine, false if it's created globally
val genGtype : Syntaxtree.ide ->
Syntaxtree.gType ->
Intermediate.dec_table -> Intermediate.intermediateCode -> bool -> unit
Used to build the correct number of entries into the Declaration Hashtable
id
: The ide of the variable, which is used as key for the table
t
: The generic Type of the variable
table
: The declaration Table
ic
: The instance of the IntermediateCode class
b
: True if the variable is declared into a subroutine, false if it's created globally
This works only with bi-dimensional Matrix, not with n-dimensional Vectors
val genDecTable : Syntaxtree.dec list ->
Intermediate.dec_table ->
Intermediate.intermediateCode -> bool -> Intermediate.dec_table
Generate the table of declarations from the dec list
Returns The updated table of declaration
decl
: The declaration list
table
: The declaration Hashtable
ic
: The instance of the IntermediateCode class
b
: True if the variable is declared into a subroutine, false if it's created globally
val getVarDeclaration : Syntaxtree.ide -> Intermediate.dec_table -> int * int * Intermediate.element
Find the binded value corresponding to the ide into the Hashtable (where ide is the identifier for a variable, NOT Vectors or Matrix)
Raises NON_DECLARED_VARIABLE
When the requested ide isn't binded into the table
Returns The value binded with Ide(id) into table
table
: The declaration table
val getVecDeclaration : Syntaxtree.ide ->
int -> int -> Intermediate.dec_table -> int * int * Intermediate.element
Find the binded value corresponding to the ide into the Hashtable (where ide is the identifier for Vectors or Matrix)
Raises NON_DECLARED_VARIABLE
When the requested ide isn't binded into the table
Returns The value binded with Ide(id) with the specified components into table
x
: The X coordinate of the Vector/Matrix
y
: The Y coordinate of the Matrix (-1 if the ide refers to a Vector, which has only one component)
table
: The declaration table
val isVarDeclared : Syntaxtree.ide -> Intermediate.dec_table -> bool
Check if the variable is binded into the Hashtable
Returns True of the variable is binded, False otherwise
id
: The ide of the variable to check
table
: The declaration Table