Commit Graph

107 Commits

Author SHA1 Message Date
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 62e2095f31 Add standard build targets (distclean, realclean, install, uninstall). 2012-07-14 13:42:54 -05:00
Jesse D. McDonald 06679a2790 Ignore dependency (*.d) files. 2012-07-14 13:42:51 -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 baa2dae345 Rearrange example programs based on new modularity feature. 2012-07-14 13:42:18 -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 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 5e36910eab Rewrite cat.rla to be closer to what a compiler should generate. 2012-07-14 13:42:08 -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 e18863c3ad Simplify number reader; eliminates potentially invalid double-ungetc(). 2012-07-14 13:42:00 -05:00
Jesse D. McDonald 307ed97b45 Rename "core-image.rla" now that there are two such images. 2012-07-14 13:41:56 -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 ce3c4f1ce9 Increase block size in cat.rla. Print GC stats to stderr. 2012-07-14 13:41:49 -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 c1a0850bcf Add builtin wrappers for the basic POSIX file APIs. 2012-07-14 13:41:00 -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 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 6a12d967ef If hard limit is exceeded, try to allocate more memory from the OS.
Reduce initial allocation to 1 MB now that it can by increased at runtime.
Also remove 'noreturn' attribute from the public API.
If out_of_memory() returns, GC will abort() internally.
2012-07-14 13:40:40 -05:00
Jesse D. McDonald 88ebc7ca77 Print results individually, on separate lines, rather than as a list. 2012-07-14 13:40:34 -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 fb248d9235 Add a formal public-domain dedication so that others can use this. 2012-07-14 13:40:14 -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 861f1f7617 Commit first working Rosella program.
Takes a string argument, converts it with string->number, and returns the factorial.
2012-07-14 13:40:06 -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 53b1cc213b Skip reader test by default to allow profiling. 2012-07-14 13:38:47 -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
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 d1dcb77503 Update printer to display 'undefined' values as "#<undefined>". 2012-07-14 13:38:37 -05:00
Jesse D. McDonald 56a67a263d Add an 'undefined' value and a function to convert booleans into values. 2012-07-14 13:38:36 -05:00
Jesse D. McDonald 0005ef2f86 Assign numbers to the bytecodes. Place all unary codes into one group. 2012-07-14 13:38:34 -05:00
Jesse D. McDonald d80e0c1fd3 CLOCK_MONOTONIC and uint64_t aren't entirely portable. 2012-07-14 13:38:32 -05:00
Jesse D. McDonald cec35b4d7c Initial revision of .hgignore committed to version control. 2012-07-14 13:38:30 -05:00
Jesse D. McDonald dc35896174 Need to parenthesize "n" in SPECIAL_VALUE macro for precedence.
This was causing the type tags to overlap with fixnums.
2012-07-14 13:38:26 -05:00
Jesse D. McDonald 26819cafdc Update list of weak boxes *after* processing finalizers.
It's a bit unlikely, but a finalizer could be arranged for a weak box.
Also add more assertions, clear old range in debug builds, and misc. cleanup.
2012-07-14 13:38:23 -05:00
Jesse D. McDonald 4136b74e1b If (any) option is given, run GC test forever. Otherwise just run it once. 2012-07-14 13:38:20 -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
Jesse D. McDonald 080906fa72 Move documentation into a subdirectory. 2012-07-14 13:37:48 -05:00
Jesse D. McDonald f9f3cae062 Test new weak-box and finalizer functions. Includes value-printer. 2012-07-14 13:37:47 -05:00
Jesse D. McDonald 7bd6e616ff Add support for weak boxes and wills/finalizers.
Also refactored some GC code into smaller functions.

Weak boxes and wills will be useful for implementing weak hash tables,
which in turn will be used to store dynamic parameters efficiently.
2012-07-14 13:37:41 -05:00
Jesse D. McDonald 5a0789c788 Fix an infinite-recursion bug in the DEBUG=yes condition. 2012-07-14 13:37:40 -05:00
Jesse D. McDonald d8d11f2da2 Initial revision of low-level representation and compiler design. 2012-07-14 13:37:39 -05:00