SB How ScriptBasic works Introduction to ScriptBasic Modules.
-
Upload
rolf-joseph -
Category
Documents
-
view
213 -
download
1
Transcript of SB How ScriptBasic works Introduction to ScriptBasic Modules.
S B
How ScriptBasic works
Introduction to ScriptBasicModules
S B Contents
• Who is this presentation for• Why modules, what is a module?• What modules run ScriptBasic
programs• Auxiliary modules• Sources for more information
S B Who this presentation is for
• Curious (why things happen?)• Want to learn and understand how
ScriptBasic works• Want to modify ScriptBasicNOT for those, who just• want to program in scriba
S B What is a module?
• More or less standalone function collection
• A typedef collects all global (class) data
• Thread safe
S B What modules are in ScriptBasic
• Reader• Tokenizer• Syntax analyzer• Builder• Execution system
• Other auxiliary modules
S B READER
• Reads the whole source into memory
• Creates a linked list of lines• Handles include directives
reader.c
S B TOKENIZER
• Gets the input from the lines read by reader
• Results a linked list of tokens• Tables define what
– a symbol is,– operators, built-in functions, keywords
• Handles continuation lineslexer.c
S B SYNTAX ANALYZER
• Uses list of tokens• Creates complex, fragmented
memory structure• Tables define
– commands syntax– unary and binary operators– built-in functions– expression syntax is as usual, hard
coded
expression.c
S B BUILDER
• Takes the fragmented, complex memory structure
• Creates a simplified structure in a continuos memory space. This is the final executable format of a ScriptBasic program.
• Has function to save and load compiled code.
builder.c
S B EXECUTION SYSTEM
• Gets the built code and executes.• Allocates memory for variables.• Allocates/releases memory for
local variables• Handles error conditions, etc...
execute.c
S B AUXILIARY MODULES
• Memory management module (myalloc.c)
• Variable management module (memory.c)
• External module handling (modumana.c)
• Symbol table handling (sym.c)
S B Sources of information
• Presentations (ready or planned) on other modules
• Source documentation in HTML format
• scriba.doc telling some details
• well, you have the source code…
S B
Thank you for listening