Commit Graph

22 Commits

Author SHA1 Message Date
Jesse D. McDonald 03c3dec091 Extend reader with placeholders for immutable values and structures.
This means that such values can once again contain references (#=nnn).
2012-07-14 13:47:15 -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 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 6dd02a5d6e Stop reading at EOF, and signal an error when EOF occurs inside a string. 2012-07-14 13:43:32 -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 ca8d68c023 Add automatic dependency tracking to the build rules.
Move optional extension modules (e.g. mod_io.c) into mods/ subdir.
Fix missing #include in reader.c.
2012-07-14 13:42:30 -05:00
Jesse D. McDonald ec306ef31f Adjust indirect form (#i"path") to be relative to the current file. 2012-07-14 13:42:16 -05:00
Jesse D. McDonald 6254044280 Add #i"pathname" syntax for reading values from modular input files. 2012-07-14 13:42:14 -05:00
Jesse D. McDonald e18863c3ad Simplify number reader; eliminates potentially invalid double-ungetc(). 2012-07-14 13:42:00 -05:00
Jesse D. McDonald 912a620c5a Add some error-handling to cat.rla. Add support for #! lines.
Also fix an off-by-one error in the column counter and suppress GC stats.
2012-07-14 13:41:52 -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 aa461c8574 Add basic support for reading floating-point values.
No guarantees are made as to the precision.
2012-07-14 13:40:50 -05:00
Jesse D. McDonald c1ac1323bf Check for errors when opening program file.
Add a debug assertion in the reader to catch bugs like the last one.
2012-07-14 13:40:29 -05:00
Jesse D. McDonald 8e34feea0b Fix an order-of-operations bug in finalize_placeholders().
The bug would have prevented the resolution of multiple levels of links.
2012-07-14 13:40:24 -05:00
Jesse D. McDonald 9f0dc52934 Improve number-reading in preparation for supporting floating-point. 2012-07-14 13:40:21 -05:00
Jesse D. McDonald 902c489b90 Resolve all placeholders before patching. Allows direct links (#0=#=0).
Definitions and references can be made in any order.
Cyclic placeholders resolve to #<undefined>, as do ones without definitions.
2012-07-14 13:40:17 -05:00
Jesse D. McDonald 48eb22d15b Update reader to fix corner-cases in the placeholder/back-reference system. 2012-07-14 13:40:16 -05:00
Jesse D. McDonald 0404777049 Fix interaction between comments and whitespace in the reader.
Add support for fixnums in binary (0b), octal (0), and hexadecimal (0x).
Minor changes to the example input program to improve readability.
2012-07-14 13:40:11 -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 439491a80e Support negative fixnums in input, and perform some extra validation. 2012-07-14 13:38:45 -05:00
Jesse D. McDonald 449b0cf478 Implement fixed-function reader for getting data into the interpreter. 2012-07-14 13:38:44 -05:00