-
Notifications
You must be signed in to change notification settings - Fork 117
Passes
MY-BASIC is a two passes interpreter. A loading pass and a running pass comprise a complete interpretation procedure.
Loading
MY-BASIC does tokenization and parsing in a single loading pass. Characters are analysed one by one. It will be appended to an abstract syntax list when a lexical token is cut off one by one. It doesn't check syntax legality during loading pass.
MY-BASIC lookup from hash tables (or called symbol table) to tell if a tokenized symbol is a function, an identifier or something else, therefore the _HT_ARRAY_SIZE_DEFAULT
macro described in Customizable macros could influence the loading speed.
Running
MY-BASIC iterates each node in an abstract syntax list and interprets it. In simple terms, when the interpretation pointer met a function symbol it just hand execution over to that function which could retrieve arguments, then do some calculation, finally push something back to the interpreter context. It triggers errors when an unexpected token was reached, and break off the entire interpretation.
An interpretation terminates normally after all tokens are interpreted if there is no error.
For detail information about full interpreter workflow, see the interpreter workflow diagram Wiki page.
- Principles
- Coding
- Data types
- Standalone shell
- Integration
- Customization
- More scripting API
- FAQ