Commit Graph

23 Commits

Author SHA1 Message Date
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 fd62415dee Fix pattern-matching for (value-list (#%apply ...)), etc.
Fix assertion in gc_object_left_behind() to work in Gen-0 collection.
Add (weak-box?) and (make-weak-box) primitives. (unbox) now works for both.
Add option to just simplify the input (stops before reduce-function).
Default to writing .rla without indentation, comments, or newlines.
2012-07-14 13:45:58 -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 96b3bded17 Add a primitive operation to calculate a 30-bit hash from any value.
Pairs, boxes, and strings are hashed by values; vectors and structures
are "hashed" by reference. Takes into account the possibility of cycles.
This is a prelude to implementing hash-tables.
2012-07-14 13:45:40 -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 885a1ebdbb Fix a missing-root error in interp.c:perform_tail_call(). 2012-07-14 13:43:39 -05:00
Jesse D. McDonald f542fa2bd5 Add bytecodes to skip the rest of a block based on a condition.
Should simplify error-handling and sequences of primitive tests.
Also, automatically instantiate templates used in the tail-call lambda & cont'n fields.
2012-07-14 13:43:33 -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 075cbac672 Remove some unnecessary write barriers for better performance. 2012-07-14 13:43:04 -05:00
Jesse D. McDonald 32952e9aa4 Add (empty) write barriers in preparation for more advanced GC. 2012-07-14 13:43:03 -05:00
Jesse D. McDonald 8ca34f40ec Add a bytecode which returns the type of a given structure. 2012-07-14 13:42:59 -05:00
Jesse D. McDonald ea9b1734fd Improve trace output, for debugging. 2012-07-14 13:42:12 -05:00
Jesse D. McDonald 601aa9db67 Re-write factorial.rla to be closer to what a compiler should generate. 2012-07-14 13:42:10 -05:00
Jesse D. McDonald 8f263daffc Add a reserved input code for 'self', the current lambda.
Correct an error in the documentation for the condition bytecode(s).
Adjust the printer to limit the depth of non-cyclic object output.
2012-07-14 13:42:04 -05:00
Jesse D. McDonald 0e62641919 Check in a second program, this time demonstrating basic I/O.
Also filter cycles and long byte-strings from print_value() output.
Added three new bytecodes to get the sizes of vectors, strings, and structs.
2012-07-14 13:41:37 -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 bc10f59c6e Allocate space for max. number of frame variables up front.
Allows us to avoid reallocating a new vector after every tail-call.
2012-07-14 13:40:47 -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 10fbc269c5 Implement the remaining bytecodes. Adjust some of the numbering.
Also, use #<undefined> for "not yet initialized" and #f for "no value".
2012-07-14 13:38:40 -05:00
Jesse D. McDonald 61e0583932 Implement bytecode, other than floating-point operations. 2012-07-14 13:38:38 -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