all symbol tables together More...
#include <dutables.h>
Public Member Functions | |
bool_const_symbol_pointer | add_const_bool (int line, ls_id_index idx, bool val) |
creates a representation of boolean constant | |
int_const_symbol_pointer | add_const_int (int line, ls_id_index idx, ls_int_index symidx) |
creates a representation of integer constant | |
real_const_symbol_pointer | add_const_real (int line, ls_id_index idx, ls_real_index symidx) |
creates a representation of real constant | |
str_const_symbol_pointer | add_const_str (int line, ls_id_index idx, ls_str_index symidx) |
creates a representation of string constant | |
function_symbol_pointer | add_fnc (int line, ls_id_index idx, type_pointer ltype, parameter_list *parlist) |
creates a representation of function | |
label_symbol_pointer | add_label_entry (int line, ls_int_index idx, ic_label lbl) |
creates a representation of label | |
procedure_symbol_pointer | add_proc (int line, ls_id_index idx, parameter_list *parlist) |
creates a representation of procedure | |
type_symbol_reference | add_type (int line, ls_id_index idx, type_pointer ltype) |
creates a representation of named type | |
variable_symbol_pointer | add_var (int line, ls_id_index idx, type_pointer ltype) |
creates a variable representation | |
type_pointer | create_array_type (type_pointer index_type, type_pointer element_type) |
creates an array type representation | |
type_pointer | create_range_type (ls_int_index i1, ls_int_index i2) |
creates a range type representation | |
type_pointer | create_record_type (field_list *fldlist, int line=0) |
creates a record type representation | |
bool | enter (int line, ls_id_index idx) |
opens a block of a procedure or function | |
label_symbol_pointer | find_label (ls_int_index idx) |
finds a label | |
symbol_pointer | find_symbol (ls_id_index symidx) |
finds a symbol | |
void | leave (int line) |
closes a block of a procedure or function | |
type_pointer | logical_bool () |
boolean type | |
type_pointer | logical_integer () |
integer type | |
type_pointer | logical_real () |
real type | |
type_pointer | logical_string () |
string type | |
type_pointer | logical_undef () |
undefined type | |
ls_id_type & | ls_id () |
identifier storage | |
ls_int_type & | ls_int () |
integer literal storage | |
ls_real_type & | ls_real () |
real literal storage | |
ls_str_type & | ls_str () |
string literal storage | |
ls_id_index | my_function_name () const |
current function | |
stack_address | my_return_address () |
place for the returned value | |
bool | nested () const |
checks enter/leave status | |
mlc::ls_int_type::const_iterator | one () |
integer literal 1 | |
bool | set_main_code (ls_id_index idx, icblock_pointer icb) |
assign code to the main block | |
bool | set_subprogram_code (ls_id_index idx, icblock_pointer icb) |
assign code to a function | |
Friends | |
int | symtab_postprocess (struct MlaskalCtx *ctx, const std::string &dump_fname) |
destroys the symbol tables | |
int | symtab_preprocess (MlaskalCtx *ctx, bool debug) |
creates the symbol tables |
all symbol tables together
bool_const_symbol_pointer mlc::symbol_tables::add_const_bool | ( | int | line, | |
ls_id_index | idx, | |||
bool | val | |||
) |
creates a representation of boolean constant
creates a bool_const_symbol entry for 'const idx
= val'
line
is a line number
int_const_symbol_pointer mlc::symbol_tables::add_const_int | ( | int | line, | |
ls_id_index | idx, | |||
ls_int_index | symidx | |||
) |
creates a representation of integer constant
creates a int_const_symbol entry for 'const idx
= val'
line
is a line number
real_const_symbol_pointer mlc::symbol_tables::add_const_real | ( | int | line, | |
ls_id_index | idx, | |||
ls_real_index | symidx | |||
) |
creates a representation of real constant
creates a real_const_symbol entry for 'const idx
= symidx'
line
is a line number
str_const_symbol_pointer mlc::symbol_tables::add_const_str | ( | int | line, | |
ls_id_index | idx, | |||
ls_str_index | symidx | |||
) |
creates a representation of string constant
creates a str_const_symbol entry for 'const idx
= symidx'
line
is a line number
function_symbol_pointer mlc::symbol_tables::add_fnc | ( | int | line, | |
ls_id_index | idx, | |||
type_pointer | ltype, | |||
parameter_list * | parlist | |||
) |
creates a representation of function
creates a function_symbol entry for 'function idx
( parlist
) : ltype'
line
is a line number
label_symbol_pointer mlc::symbol_tables::add_label_entry | ( | int | line, | |
ls_int_index | idx, | |||
ic_label | lbl | |||
) |
creates a representation of label
creates a label_symbol entry for 'label idx'
label is identified by an integer literal idx
lbl
should be an unique intermediate code label (created by new_label())
line
is a line number
procedure_symbol_pointer mlc::symbol_tables::add_proc | ( | int | line, | |
ls_id_index | idx, | |||
parameter_list * | parlist | |||
) |
creates a representation of procedure
creates a procedure_symbol entry for 'procedure idx
( parlist
)'
line
is a line number
type_symbol_reference mlc::symbol_tables::add_type | ( | int | line, | |
ls_id_index | idx, | |||
type_pointer | ltype | |||
) |
creates a representation of named type
creates a type_symbol entry for 'type idx
= symidx'
line
is a line number
variable_symbol_pointer mlc::symbol_tables::add_var | ( | int | line, | |
ls_id_index | idx, | |||
type_pointer | ltype | |||
) |
creates a variable representation
creates a global_variable_symbol or local_variable_symbol entry for 'var idx
: ltype'
(based on symbol_tables::nested())
line
is a line number
type_pointer mlc::symbol_tables::create_array_type | ( | type_pointer | index_type, | |
type_pointer | element_type | |||
) |
creates an array type representation
creates an array_type entry for 'array [ index_type
] of element_type'
type_pointer mlc::symbol_tables::create_range_type | ( | ls_int_index | i1, | |
ls_int_index | i2 | |||
) |
creates a range type representation
creates a range_type entry for 'i1
.. i2'
type_pointer mlc::symbol_tables::create_record_type | ( | field_list * | fldlist, | |
int | line = 0 | |||
) |
creates a record type representation
creates a record_type entry for 'record field_list end'
bool mlc::symbol_tables::enter | ( | int | line, | |
ls_id_index | idx | |||
) |
opens a block of a procedure or function
idx
must be an identifier of a procedure or a function that already has its entry
line
is a line number
label_symbol_pointer mlc::symbol_tables::find_label | ( | ls_int_index | idx | ) |
finds a label
finds a label entry identified by integer literal idx
symbol_pointer mlc::symbol_tables::find_symbol | ( | ls_id_index | symidx | ) |
finds a symbol
returns an abstract_symbol representation assigned to the identifier symidx
void mlc::symbol_tables::leave | ( | int | line | ) |
closes a block of a procedure or function
line
is a line number
type_pointer mlc::symbol_tables::logical_bool | ( | ) |
boolean type
returns a BoolType representation of 'boolean' type
type_pointer mlc::symbol_tables::logical_integer | ( | ) |
integer type
returns an int_type representation of 'integer' type
type_pointer mlc::symbol_tables::logical_real | ( | ) |
real type
returns a real_type representation of 'real' type
type_pointer mlc::symbol_tables::logical_string | ( | ) |
string type
returns a str_type representation of 'string' type
type_pointer mlc::symbol_tables::logical_undef | ( | ) |
undefined type
returns an abstract_type representation of undefined type
ls_id_type& mlc::symbol_tables::ls_id | ( | ) | [inline] |
identifier storage
ls_int_type& mlc::symbol_tables::ls_int | ( | ) | [inline] |
integer literal storage
ls_real_type& mlc::symbol_tables::ls_real | ( | ) | [inline] |
real literal storage
ls_str_type& mlc::symbol_tables::ls_str | ( | ) | [inline] |
string literal storage
ls_id_index mlc::symbol_tables::my_function_name | ( | ) | const |
current function
returns the identifier of the current function (as defined by enter())
stack_address mlc::symbol_tables::my_return_address | ( | ) |
place for the returned value
returns the stack offset of the returned value
bool mlc::symbol_tables::nested | ( | ) | const |
checks enter/leave status
returns true if inside a procedure or function block
mlc::ls_int_type::const_iterator mlc::symbol_tables::one | ( | ) |
integer literal 1
returns the integer literal '1'
bool mlc::symbol_tables::set_main_code | ( | ls_id_index | idx, | |
icblock_pointer | icb | |||
) |
assign code to the main block
defines the code of the main block of a program named idx
using icblock icb
icblock icb
is inserted between prologue and epilogue code (including HALT) automatically generated from global variable declarations
bool mlc::symbol_tables::set_subprogram_code | ( | ls_id_index | idx, | |
icblock_pointer | icb | |||
) |
assign code to a function
defines the code of a function/procedure named idx
using icblock icb
icblock icb
is inserted between prologue and epilogue code (including RET) automatically generated from local variable declarations
int symtab_postprocess | ( | struct MlaskalCtx * | ctx, | |
const std::string & | dump_fname | |||
) | [friend] |
destroys the symbol tables
will be called after the parser has finished
returns 0, if OK; otherwise !=0
int symtab_preprocess | ( | MlaskalCtx * | ctx, | |
bool | debug | |||
) | [friend] |
creates the symbol tables
will be called before the parser is started
returns 0, if OK; otherwise !=0