Class Symbol¶
- Defined in File symbol_table.h
Class Documentation¶
-
class
Symbol¶ Public Functions
-
Symbol(const std::string &name, bool is_field)¶ Initialize a new symbol. The class is set to
- Parameters
name: Name of the symbolis_field: True if the symbol is a class field.
Friends
-
friend
Symbol::CodeGen::Gen
-
friend
Symbol::Quack::Class
-
class
Table¶ Public Functions
-
~Table()¶ Deletes all symbols in the table.
-
void
add_new(const std::string &symbol_name, bool is_field, Quack::Class *new_class)¶ Adds a new symbol the table. The symbol is set to the base class of all classes.
- Parameters
symbol_name: Name of the symbolis_field: True if the new symbol is a field Updates the class of the specifiedsymbol:new_class:
-
void
update(const std::string &symbol_name, bool is_field, Quack::Class *new_class)¶ Updates the class of the specified symbol. If the object class has changed, the symbol table is marked as dirty.
- Parameters
symbol_name: Name of the symbol to update.new_class: True if the corresponding symbol is a class field.
-
void
update(const Symbol *symbol, Quack::Class *new_class)¶ Updates the class of the specified symbol. If the object class has changed, the symbol table is marked as dirty.
- Parameters
symbol_name: Name of the symbol to update.new_class: True if the corresponding symbol is a class field.
-
const bool
is_dirty() const¶ Accessor for whether the symbol table is dirty, i.e., whether it has changed since the last time the dirty was clear.
- Return
- True if a change has occurred.
-
void
clear_dirty()¶ Resets the dirty flag for the symbol table.
-
Symbol *
get(const std::string &symbol_name, bool is_field) const¶ Accessor for a symbol table item.
- Return
- Corresponding symbol object.
- Parameters
symbol_name: Name of the symbolis_field: True if the symbol is a field.
-
-