Presentation is loading. Please wait.

Presentation is loading. Please wait.

SB Symbol table handling in ScriptBasic The Module sym.

Similar presentations


Presentation on theme: "SB Symbol table handling in ScriptBasic The Module sym."— Presentation transcript:

1 SB Symbol table handling in ScriptBasic The Module sym

2 SB Contents Who is this presentation for What is this module Data structures the module uses Services of the module How symbol/value pairs are stored Where is it used in ScriptBasic

3 SB Who this presentation is for Curious (why things happen?) Want to learn and understand how ScriptBasic works Want to modify ScriptBasic Want to use the module outside ScriptBasic NOT for those, who just want to program in scriba

4 SB What is this module? Handles association of string and value –string is a ZCHAR terminated C string –value is (void *) pointer Handles one or more symbol tables

5 SB Data structures typedef struct _symbol { char *name; void *value; struct _symbol *small_son, *big_son; } Symbol, *pSymbol, **SymbolTable;

6 SB Services of the module Create new symbol table –memory allocation via function pointers Lookup symbol Traverse symbol table –Calls a callback function with symbol name, symbol value (pointer) and a (void *) pointer Destroy symbol table –does not release the memory pointed by value pointers

7 SB How symbol/value pairs are stored A symbol table is a hash of 211 elements –Hash function from Aho-Sethi-Ulman: Compilers Principles, techniques, and Tools Addison-Wesley Publishing Company 1986 Each hash element is a binary tree

8 SB Where is it used? Syntax analysis –Global, local variables –Functions Not used by the run-time system Available for external modules

9 SB Thank you for listening


Download ppt "SB Symbol table handling in ScriptBasic The Module sym."

Similar presentations


Ads by Google