Commit Graph

24 Commits

Author SHA1 Message Date
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 a9427d2ec5 In-VM reader for high-level Scheme syntax, initial revision.
Currently supports booleans, lists/pairs, fixnums (incl. 0x, 0b,
0, #x, #d, #o, and #b radix prefixes), basic byte strings, boxes,
weak boxes, script headers (#!), and end-of-line comments.
TODO: Floating-point, vectors, structs, symbols, cyclic references.
2012-07-14 13:46:00 -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 50d9e0e0fc Commit high-level version of existing primitive functions. 2012-07-14 13:45:35 -05:00
Jesse D. McDonald 269a512e20 Commit function wrappers for builtin primitive operations. 2012-07-14 13:45:31 -05:00
Jesse D. McDonald 2f67f502f7 Convert cat.rla to high-level language and rename as cat.rls. 2012-07-14 13:45:26 -05:00
Jesse D. McDonald b3fd7bf6fc Adjust initial allocations to improve memory efficiency.
Also convert existing .rls (Rosella Source) files to module syntax.
2012-07-14 13:45:20 -05:00
Jesse D. McDonald 5c8625a1f1 Check in some sample programs demonstrating the compiler. 2012-07-14 13:44:55 -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 7e5014ab07 Correct oversight - 0xfe was not changed to 0xff in lambda args. 2012-07-14 13:43:30 -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 9af29f28da Commit basic (and ...) & (or ...) *functions*, with lambda args. 2012-07-14 13:43:25 -05:00
Jesse D. McDonald 893b7e122e Commit (append ...) function, implemented as nested (foldr ...) calls. 2012-07-14 13:43:24 -05:00
Jesse D. McDonald a6715b0922 More primitive functions: map, reverse, acons. 2012-07-14 13:43:23 -05:00
Jesse D. McDonald 2d7b079dd8 Make (foldl ...) state the second argument, as with (foldr ...). 2012-07-14 13:43:22 -05:00
Jesse D. McDonald c6500a53b3 Commit implementation of (foldl ...) function. 2012-07-14 13:43:21 -05:00
Jesse D. McDonald 3a418484c8 Commit (foldr ...) function, and refactor (list ...) to use it. 2012-07-14 13:43:20 -05:00
Jesse D. McDonald a1db12d1e2 Commit implementation of (list ...) primitive function. 2012-07-14 13:43:18 -05:00
Jesse D. McDonald baa2dae345 Rearrange example programs based on new modularity feature. 2012-07-14 13:42:18 -05:00