1 / 9

Symbol table handling in ScriptBasic

Symbol table handling in ScriptBasic. The Module sym. 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. Contents. Who this presentation is for.

violet
Download Presentation

Symbol table handling in ScriptBasic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Symbol table handling in ScriptBasic The Module sym

  2. 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 Contents

  3. 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. 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. Data structures typedef struct _symbol { char *name; void *value; struct _symbol *small_son, *big_son; } Symbol, *pSymbol, **SymbolTable;

  6. 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. How symbol/value pairs are stored • A symbol table is a hash of 211 elements • Hash function fromAho-Sethi-Ulman: Compilers Principles, techniques, and ToolsAddison-Wesley Publishing Company 1986 • Each hash element is a binary tree

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

  9. Thank you for listening

More Related