SB How ScriptBasic works Introduction to ScriptBasic Modules.

13
S B How ScriptBasic works Introduction to ScriptBasic Modules

Transcript of SB How ScriptBasic works Introduction to ScriptBasic Modules.

Page 1: SB How ScriptBasic works Introduction to ScriptBasic Modules.

S B

How ScriptBasic works

Introduction to ScriptBasicModules

Page 2: SB How ScriptBasic works Introduction to ScriptBasic Modules.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

S B

Thank you for listening