NAME

languages/cola/sym.c

DESCRIPTION

Symbol and Abstract Syntax Tree management utils.

Functions

Routines for managing symbols, attributes and AST tree

void assert(void *p)
RT#48200: Not yet documented!!!
unsigned int hash_str(const char *str)
RT#48200: Not yet documented!!!
void init_symbol_tables()
RT#48200: Not yet documented!!!
SymbolTable *new_symbol_table()
RT#48200: Not yet documented!!!
Symbol *new_symbol(const char *name)
RT#48200: Not yet documented!!!
Symbol *new_identifier_symbol(const char *name)
RT#48200: Not yet documented!!!
Symbol *new_literal_symbol(const char *name)
RT#48200: Not yet documented!!!
Symbol *new_type_symbol(const char *name)
RT#48200: Not yet documented!!!
Symbol *mk_namespace_symbol(Symbol *identifier)
RT#48200: Not yet documented!!!
Symbol *mk_class_symbol(Symbol *identifier)
RT#48200: Not yet documented!!!
Symbol *mk_method_symbol(Symbol *rettype, const char *name, const char *sig)
RT#48200: Not yet documented!!!
Symbol *symbol_concat(Symbol *s1, Symbol *s2)
RT#48200: Not yet documented!!!
Symbol *symbol_join3(Symbol *s1, Symbol *s2, Symbol *s3)
RT#48200: Not yet documented!!!
Symbol *symbol_join4(Symbol *s1, Symbol *s2, Symbol *s3, Symbol *s4)
RT#48200: Not yet documented!!!
AST *new_ast(enum ASTKIND kind, int asttype, AST *arg1, AST *arg2)
RT#48200: Not yet documented!!!
void push(Node ** list, Node *p)
RT#48200: Not yet documented!!!
void tpush(Node ** list, Node *p)
RT#48200: Not yet documented!!!
void tunshift(Node ** list, Node *p)
"push" onto opposite end of temp stack
Node *pop(Node ** list)
Return the top symbol on the stack.
Node *tpop(Node ** list)
Return the top symbol on the tstack.
void push_sym(Symbol ** list, Symbol *p)
RT#48200: Not yet documented!!!
void tpush_sym(Symbol ** list, Symbol *p)
RT#48200: Not yet documented!!!
void tunshift_sym(Symbol ** list, Symbol *p)
"push" onto opposite end of temp stack
Symbol *pop_sym(Symbol ** list)
Return the top symbol on the stack.
Symbol *tpop_sym(Symbol ** list)
Return the top symbol on the tstack.
void push_namespace(Symbol *ns)
Push namespace onto the stack and set active namespace to top of stack.
Symbol *pop_namespace()
Pop namespace off the stack and set active namespace to top of stack. Leaves namespace symbol in symbol table.
void unshift_ast(AST ** list, AST *p)
"push" onto opposite end of stack
AST *new_statement(int stmnttype, AST *left, AST *right)
RT#48200: Not yet documented!!!
AST *new_expr(int exprtype, AST *left, AST *right)
RT#48200: Not yet documented!!!
AST *new_op_expr(AST *left, int op, AST *right)
Specific type of expression (A b C) where b is an operator
AST *new_logical_expr(AST *left, int op, AST *right)
RT#48200: Not yet documented!!!
AST *new_if(AST *condition, AST *then_part, AST *else_part)
RT#48200: Not yet documented!!!

Ternary conditionals

AST *new_conditional(AST *condition, AST *then_part, AST *else_part)
RT#48200: Not yet documented!!!
AST *new_while(AST *condition, AST *block)
RT#48200: Not yet documented!!!
AST *new_for(AST *init, AST *condition, AST *iteration, AST *block)
RT#48200: Not yet documented!!!
Symbol *split(const char *pattern, const char *s)
Only using first char of pattern for now.
Symbol *lookup_symbol(const char *name)
Return first occurence of symbol in surrounding scopes.
Symbol *lookup_symbol_in_tab(SymbolTable *tab, const char *name)
RT#48200: Not yet documented!!!
Symbol *lookup_namespace(SymbolTable *tab, const char *name)
RT#48200: Not yet documented!!!
Symbol *lookup_class(SymbolTable *tab, const char *name)
RT#48200: Not yet documented!!!
Symbol *lookup_symbol_scope(SymbolTable *tab, const char *name, int scope_level)
RT#48200: Not yet documented!!!
Symbol *store_symbol(SymbolTable *tab, Symbol *sym)
RT#48200: Not yet documented!!!
Symbol *store_method(SymbolTable *tab, const char *name, Type *type)
RT#48200: Not yet documented!!!
void declare_local(Symbol *s)
Method locals
void declare_field(Symbol *s)
Class fields
void dump_namespace(Symbol *ns)
RT#48200: Not yet documented!!!
void dump_symbol_table(SymbolTable *tab)
RT#48200: Not yet documented!!!
Symbol *check_id_redecl(SymbolTable *table, const char *name)
RT#48200: Not yet documented!!!
Symbol *check_id_decl(SymbolTable *table, const char *name)
RT#48200: Not yet documented!!!
int push_scope()
RT#48200: Not yet documented!!!
Symbol *pop_scope()
Pop current scope level and return a list of symbols if symbol table is passed.
void discard_scope()
Same as pop_scope except no list is built and returned. This is for cases where a list already existed, and each node was inserted into the symbol table, and we want to preserve that external list, so we can't scribble on the ->tnext pointer as it may reorder the list or invalidate it.
void push_primary_block(AST *p)
Don't laugh, this little array based stack is so I don't have to add a 3rd ->next pointer to the AST struct. It also means my design is wrong, will fix after adding brain expansion pack.
AST *pop_primary_block()
RT#48200: Not yet documented!!!
AST *get_cur_primary_block()
RT#48200: Not yet documented!!!
char *str_dup(const char *old)
RT#48200: Not yet documented!!!
char *str_cat(const char *s1, const char *s2)
RT#48200: Not yet documented!!!