Commit Graph

13 Commits

Author SHA1 Message Date
Jesse D. McDonald be48535995 Change bytecode from 'frame' vars to 'transient' values.
Each transient identifies the value of the corresponding previous bytecode.
This change (a) frees up many bytecodes formerly used by the conditional
expression (if c t f); (b) regularizes the bytecode by always placing opcodes
before operands; and (c) causes the bytecode to conform to the Single Static
Assignment (SSA) form preferred by e.g. LLVM.

Includes updates to the hand-assembled files (*.rla) and the bytecode compiler.
2012-07-14 13:47:28 -05:00
Jesse D. McDonald 42312e394a Add a helper function for creating structure types. 2012-07-14 13:47:13 -05:00
Jesse D. McDonald 892af308ce Add support for immutable vectors, byte-strings, and structures.
The interpreter now requires its input to be immutable.
The reader marks values read after '#@' as immutable, e.g. #@#(...).
2012-07-14 13:47:10 -05:00
Jesse D. McDonald 960d7917c9 Enforce that all structures have types derived from 'structure'.
Take advantage of this invariant to simplify struct type checks elsewhere.
Group (meta)structure definition with basic types.
2012-07-14 13:47:03 -05:00
Jesse D. McDonald e1662ca4b8 Convert tail-call parameters to a byte-string.
Add special variables for keyword arguments & values.
Add support for keyword arguments to (simplify-apply).
Implement full string parsing in src/reader.rls.
TODO: Support keywords in (simplify-lambda) and writer.
2012-07-14 13:46:42 -05:00
Jesse D. McDonald 9e4286b49e Refactor (define) parser to work in (let), (lambda), (begin), etc.
Add support for (fix=), (list), (and), (or), (cond), (when), and (unless).
Fix a mapper bug which could assign the same frame var to separate variables.
Update make-struct primitive for new structure type layout.
Change primitives to use #% as prefix instead of just %.
Add primitive operations for comparing byte-strings.
2012-07-14 13:45:54 -05:00
Jesse D. McDonald 061364c75c Remove structure/field names from builtin structure type.
Moves naming policy (strings/symbols) from the VM to the input image.
To restore introspection, derive annotated base types from anonymous builtins.
2012-07-14 13:45:49 -05:00
Jesse D. McDonald e375edfc83 Improve on struct_is_a() and expose it as a VM primitive operation. 2012-07-14 13:45:36 -05:00
Jesse D. McDonald bc3df6dd17 Swap continuation & context in the lambda and template structures.
This is to separate the three 'call' parameters (target, argv, ctx) from
the 'return to' parameter (k). The old order made it look as if the dynamic
context was in some way related to the continuation, which is not the case.
2012-07-14 13:43:26 -05:00
Jesse D. McDonald b74f0cddda Adjust number-reader to allow 'negative zero' FP values.
Also add builtins for NaN and +/- infinity, and bytecodes for classification.
2012-07-14 13:40:52 -05:00
Jesse D. McDonald c01f0838f1 Misc. reader improvements, plus ability to run *.rla directly.
Fix tree_replace() to handle recursive data structures.
Fix some other minor bugs in the reader and interpreter.
Implement comment-escapes in the string parser, for more readable input.
Allow input program files (*.rla) to be invoked directly, with arguments.
Add a simple string->number converter as a builtin function.
2012-07-14 13:38:48 -05:00
Jesse D. McDonald 449b0cf478 Implement fixed-function reader for getting data into the interpreter. 2012-07-14 13:38:44 -05:00
Jesse D. McDonald 0a2f13b523 Added built-in structure types and interpreter core (w/o bytecode).
Improved timing resolution by using clock_gettime() instead of clock().
Also gave project a name: Rosella. Play on 'Parrot' (Perl 6 VM).
2012-07-14 13:38:02 -05:00