Commit Graph

6 Commits

Author SHA1 Message Date
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 a76e86013a Fix loading from relative paths, and output of empty lists.
Also add some basic command-line processing to the front-end.
2012-07-14 13:45:28 -05:00
Jesse D. McDonald 387ff63a48 Fix some reader-bugs introduced in the conversion to scheme/match. 2012-07-14 13:45:25 -05:00
Jesse D. McDonald cbcea20701 Lots of misc. cleanup, and a few bug fixes.
* Remap all instance variables in one pass, to avoid an insidious bug [1].
* Fix another bug by merging promote-shared-variables and narrow-binds [2].
* Don't assume different variable means different value in propogate-set!.
* Add support for (apply), (value-list) and (call-with-values) forms.
* Add support for including files (as if directly substituted) in reader.
* Use scheme/match library to simplify form pattern-matching.
* Refactor (map-form) and (search-form) using a more basic (traverse-form),
  which just recurses over the form and returns void by default, and a
  new utility function (curry-keywords) to provide default keyword arguments.

[1] Was renaming e.g. %f0 to %i0, then %i0 to %i1, which eliminates the
distinction between %f0 and %i0. Solution is to construct a map from old
names to new names, then traverse the form and change every old variable
to its new equivalent in the map exactly once.

[2] Some variables were not being promoted to boxes, as promotions only occur
at the top-level, when constructing each lambda, and narrow-binds could push
the unpromoted variables down into a subordinate lambda form first. Solution
was to promote variables immediately after narrowing bindings, including the
recursive calls which exist after pushing variables into nested scopes.
2012-07-14 13:45:22 -05:00
Jesse D. McDonald 8318db755f Fix module syntax; should be (define ...), not (declare ...). 2012-07-14 13:45:18 -05:00
Jesse D. McDonald 723f52dc1d Rather than a single form, accept an entire module as input.
Module consists of mixed (declare ...) forms and expressions.
Groups of (declare ...) forms become (letrec ...)s surrounding
later expressions and (declare ...) groups.
The (declare (fn-name . arglist) forms...) syntax is supported.
2012-07-14 13:45:10 -05:00