Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Version 38 and Version 39 of Sysel

2011-03-06T21:38:15Z (9 years ago)
Jiri Svoboda

Some SBI internals


  • Sysel

    v38 v39  
    6161 * All errors should be handled gracefully. Calls to `exit()` must be eliminated.
     63=== How SBI works ===
     65SBI first takes all the code in the ''library'' and all the source files provided on the command-line and pre-processes them in several stages:
     67|| Parsing             || Lex and parse source files to produce a syntax tree ||
     68|| Ancestry resolution || Determine ancestry of classes and interfaces ||
     69|| Typing              || Annotate syntax tree with static types and make all type conversions explicit ||
     71The result is a syntax tree with symbol references resolved, annotated with static types and augmented
     72so that type all conversions are explicit. This syntax tree is considered the ''program'', it is
     73treated as read-only for the purpose of execution.
     75SBI has a concept of a ''runner object'' (`run_t`) which is sort of similar to a process. It has a reference to the code
     76that should be executed, to global/shared state (i.e. the heap) and to the thread(s). (There is only one thread
     77currently, anyway.) A thread has its own private state consisting of a stack (of procedure
     78activation records) and error/exception state.
     80Data is managed using a system of interlinked structures -- `rdata` nodes. `rdata_var` nodes are used to implement
     81both ''variables'' (addressable memory nodes that can be read and written) and ''values''. Values are immutable.
     82so they can be copied just by copying the pointer to them. Values can be written to or read from variables.
     84The equivalent of a data pointer in the `rdata` system is an ''address''. An address can refer both to a variable
     85or a to property. Reading from or writing to a property (using its address) causes its getter or setter to be invoked.
     86The equivalent of a code pointer is a delegate (this is not the same delegate as the language construct), which
     87refers to a symbol and, optionally, to an object instance on which the symbol should be invoked.
     89To implement L-values and R-values, an ''item'' is the result of evaluating an expression. An item can be either
     90an ''address item'' (L-value) or a ''value item'' (R-value).
    6392== NNPS ==