sb how scriptbasic works introduction to scriptbasic modules
TRANSCRIPT
![Page 1: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/1.jpg)
S B
How ScriptBasic works
Introduction to ScriptBasicModules
![Page 2: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/2.jpg)
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
![Page 3: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/3.jpg)
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
![Page 4: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/4.jpg)
S B What is a module?
• More or less standalone function collection
• A typedef collects all global (class) data
• Thread safe
![Page 5: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/5.jpg)
S B What modules are in ScriptBasic
• Reader• Tokenizer• Syntax analyzer• Builder• Execution system
• Other auxiliary modules
![Page 6: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/6.jpg)
S B READER
• Reads the whole source into memory
• Creates a linked list of lines• Handles include directives
reader.c
![Page 7: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/7.jpg)
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
![Page 8: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/8.jpg)
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
![Page 9: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/9.jpg)
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
![Page 10: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/10.jpg)
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
![Page 11: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/11.jpg)
S B AUXILIARY MODULES
• Memory management module (myalloc.c)
• Variable management module (memory.c)
• External module handling (modumana.c)
• Symbol table handling (sym.c)
![Page 12: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/12.jpg)
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…
![Page 13: SB How ScriptBasic works Introduction to ScriptBasic Modules](https://reader036.vdocument.in/reader036/viewer/2022072006/56649f505503460f94c72a54/html5/thumbnails/13.jpg)
S B
Thank you for listening