SB Symbol table handling in ScriptBasic The Module sym.

Slides:



Advertisements
Similar presentations
Incomplete Structs struct B; struct A { struct B * partner; // other declarations… }; struct B { struct A * partner; // other declarations… };
Advertisements

Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
1 Symbol Tables. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
CS 11 C track: lecture 7 Last week: structs, typedef, linked lists This week: hash tables more on the C preprocessor extern const.
Symbol Table.
SEE C GO Provisional Title. Syntax Types int, float, double, char, void Identifiers foo Operators + - * / ^ Delimiters ; {} () “” ‘’ Keywords return,
Programming Languages and Paradigms The C Programming Language.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Structures Spring 2013Programming and Data Structure1.
The Symbol Table Lecture 13 Wed, Feb 23, The Symbol Table When identifiers are found, they will be entered into a symbol table, which will hold.
Engineering Problem Solving With C++ An Object Based Approach Chapter 9 Pointers and Creating Data Structures.
ECE 353: Lab C Pointers and Structs. Basics A pointer holds an address to some variable Notation: – Dereferencing operator: * int *x is a declaration.
Dynamic Memory Allocation in C++. Memory Segments in C++ Memory is divided in certain segments – Code Segment Stores application code – Data Segment Holds.
Elaboration or: Semantic Analysis Compiler Baojian Hua
UBC104 Embedded Systems Variables, Structures & Pointers.
Lecture 2 Pointers Pointers with Arrays Dynamic Memory Allocation.
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
Object-oriented Languages Compiler Baojian Hua
. Memory Management. Memory Organization u During run time, variables can be stored in one of three “pools”  Stack  Static heap  Dynamic heap.
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
C Tokens Identifiers Keywords Constants Operators Special symbols.
SB Implementing ScriptBasic Multi- Thread How to embed ScriptBasic multi-thread?
Functions, Pointers, Structures Keerthi Nelaturu.
Attribute Grammar Examples and Symbol Tables Compiler Design Lecture (02/23/98) Computer Science Rensselaer Polytechnic.
1 Homework HW6 due class 22 K&R 6.6 K&R 5.7 – 5.9 (skipped earlier) Finishing up K&R Chapter 6.
Chapter 17 Pointers and Arrays. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Pointers and Arrays.
1 MT258 Computer Programming and Problem Solving Unit 7.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
Chapter 0.2 – Pointers and Memory. Type Specifiers  const  may be initialised but not used in any subsequent assignment  common and useful  volatile.
Defining and Converting Data Copyright Kip Irvine, 2003 Last Update: 11/4/2003.
Dynamic Memory Allocation. Domain A subset of the total domain name space. A domain represents a level of the hierarchy in the Domain Name Space, and.
Copyright 2005, The Ohio State University 1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation.
CS536 Semantic Analysis Introduction with Emphasis on Name Analysis 1.
SB How ScriptBasic works Introduction to ScriptBasic Modules.
Chapter 1 Introduction Major Data Structures in Compiler
Slides created by: Professor Ian G. Harris Hello World #include main() { printf(“Hello, world.\n”); }  #include is a compiler directive to include (concatenate)
SB Syntax analysis How ScriptBasic performs Syntax analysis.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 14: Pointers.
ENEE150 – 0102 ANDREW GOFFIN Project 4 & Function Pointers.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved This Weeks Topics: Pointers (continued)  Modify C-String through a function call 
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
Chapter 12: Programming in the Large By: Suraya Alias 1-1.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – August 23, 2001.
Dr. Yang, QingXiong (with slides borrowed from Dr. Yuen, Joe) LT:10 Advance Pointer Array, String and Dynamic Memory Allocation CS2311 Computer Programming.
Pointers 1. Introduction Declaring pointer variables Pointer operators Pointer arithmetic 2 Topics to be Covered.
Kernel Structure and Infrastructure David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
1 Compiler Construction Run-time Environments,. 2 Run-Time Environments (Chapter 7) Continued: Access to No-local Names.
Prof. Amr Goneid, AUC1 CSCE 210 Data Structures and Algorithms Prof. Amr Goneid AUC Part R2. Elementary Data Structures.
Semantic Analysis. Find 6 problems with this code. These issues go beyond syntax.
Lecture 9 Symbol Table and Attributed Grammars
Pointers & Arrays 1-d arrays & pointers 2-d arrays & pointers.
Constructing Precedence Table
Semantic Analysis with Emphasis on Name Analysis
C Basics.
Java Review: Reference Types
CSCE 210 Data Structures and Algorithms
Hash Tables in C James Goerke.
Hash Tables in C Louis Manco.
CSC 253 Lecture 8.
CSC 253 Lecture 8.
Hash Tables: A basic O(1)verview
Local Variables, Global Variables and Variable Scope
ECE 103 Engineering Programming Chapter 64 Tree Implementation
C Programming Lecture-8 Pointers and Memory Management
SYMBOL TABLE Chuen-Liang Chen Department of Computer Science
Pointers, Dynamic Data, and Reference Types
Presentation transcript:

SB Symbol table handling in ScriptBasic The Module sym

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

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

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

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

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

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

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

SB Thank you for listening