mit-scheme.git
6 years agoReorder definitions in mit-macros into topical groups.
Chris Hanson [Fri, 30 Mar 2018 05:24:02 +0000 (22:24 -0700)]
Reorder definitions in mit-macros into topical groups.

6 years agoChange spar-transformer->runtime to provide default environment.
Chris Hanson [Fri, 30 Mar 2018 05:08:39 +0000 (22:08 -0700)]
Change spar-transformer->runtime to provide default environment.

6 years agoRename :FOO syntax names so that they aren't potential keywords.
Chris Hanson [Fri, 30 Mar 2018 05:03:25 +0000 (22:03 -0700)]
Rename :FOO syntax names so that they aren't potential keywords.

6 years agoTweak quasiquote implementation to use shorter names.
Chris Hanson [Fri, 30 Mar 2018 04:37:35 +0000 (21:37 -0700)]
Tweak quasiquote implementation to use shorter names.

Also refactor descend-pair slightly for brevity.

6 years agoChange and to be defined by syntax-rules.
Chris Hanson [Fri, 30 Mar 2018 03:55:11 +0000 (20:55 -0700)]
Change and to be defined by syntax-rules.

Also belatedly define the feature full-unicode.

6 years agoRewrite local-declare using syntax-rules.
Chris Hanson [Thu, 29 Mar 2018 07:00:51 +0000 (00:00 -0700)]
Rewrite local-declare using syntax-rules.

6 years agoConvert define-integrable, fluid-let, and paramaterize to scons-rule.
Chris Hanson [Thu, 29 Mar 2018 06:09:43 +0000 (23:09 -0700)]
Convert define-integrable, fluid-let, and paramaterize to scons-rule.

6 years agoChange unsyntaxer:* variables to be parameters and export them.
Chris Hanson [Thu, 29 Mar 2018 06:09:08 +0000 (23:09 -0700)]
Change unsyntaxer:* variables to be parameters and export them.

6 years agoFix broken unsyntaxing of scode sequences.
Chris Hanson [Thu, 29 Mar 2018 05:31:30 +0000 (22:31 -0700)]
Fix broken unsyntaxing of scode sequences.

Also fix over-long lines.

6 years agoMake second arg to scons-set! optional.
Chris Hanson [Thu, 29 Mar 2018 04:42:19 +0000 (21:42 -0700)]
Make second arg to scons-set! optional.

6 years agoRefactor how keywords are matched.
Chris Hanson [Thu, 29 Mar 2018 04:20:34 +0000 (21:20 -0700)]
Refactor how keywords are matched.

* spar-arg:compare renamed to spar-arg:id=? and second argument is optional,
  defaulting to spar-arg:form.

* patterns (noise ...), (noise-keyword ...), and (keyword ...) are eliminated.

* New pattern (ignore-if predicate arg...) ignores a subform if calling the
  predicate is satisfied.

* Renamed (value-if ...) to (keep-if ...) with same semantics: keeps a subform
  if calling the predicate is satisfied.

* New pattern (value arg) is like (values arg...) but a little clearer.

6 years agoChange spar pattern (elt ...) to (subform ...).
Chris Hanson [Thu, 29 Mar 2018 04:06:23 +0000 (21:06 -0700)]
Change spar pattern (elt ...) to (subform ...).

6 years agoRename spar*elt* to spar*subform*.
Chris Hanson [Thu, 29 Mar 2018 03:48:26 +0000 (20:48 -0700)]
Rename spar*elt* to spar*subform*.

6 years agoChange pattern->spar to make * and + operators implicitly listify.
Chris Hanson [Wed, 28 Mar 2018 06:30:54 +0000 (23:30 -0700)]
Change pattern->spar to make * and + operators implicitly listify.

6 years agoEliminate special bindings for constants in pattern->spar.
Chris Hanson [Wed, 28 Mar 2018 05:00:16 +0000 (22:00 -0700)]
Eliminate special bindings for constants in pattern->spar.

Also change leading : to $ to avoid making names look like keywords.

6 years agoRewrite patterns as (elt (list ...)) rather than (list (elt ...)).
Chris Hanson [Wed, 28 Mar 2018 04:41:07 +0000 (21:41 -0700)]
Rewrite patterns as (elt (list ...)) rather than (list (elt ...)).

6 years agoConvert and-let* to scons-rule.
Chris Hanson [Wed, 28 Mar 2018 04:34:09 +0000 (21:34 -0700)]
Convert and-let* to scons-rule.

6 years agoAdd some simple optimizations.
Chris Hanson [Wed, 28 Mar 2018 04:33:56 +0000 (21:33 -0700)]
Add some simple optimizations.

6 years agoConvert a bunch more macros to scons-rule.
Chris Hanson [Wed, 28 Mar 2018 00:17:55 +0000 (17:17 -0700)]
Convert a bunch more macros to scons-rule.

6 years agoUse folding to eliminate loops in macros.
Chris Hanson [Wed, 28 Mar 2018 00:17:36 +0000 (17:17 -0700)]
Use folding to eliminate loops in macros.

6 years agoRewrite COND and DO to use spar rules.
Chris Hanson [Tue, 27 Mar 2018 07:29:18 +0000 (00:29 -0700)]
Rewrite COND and DO to use spar rules.

6 years agoChange scons-call to not quote its operator.
Chris Hanson [Tue, 27 Mar 2018 06:54:01 +0000 (23:54 -0700)]
Change scons-call to not quote its operator.

Instead one must explicitly call scons-close when necessary.

6 years agoAdd context to items, for errors that happen during item compilation.
Chris Hanson [Tue, 27 Mar 2018 06:53:18 +0000 (23:53 -0700)]
Add context to items, for errors that happen during item compilation.

6 years agoFormalize the context of a syntax error.
Chris Hanson [Tue, 27 Mar 2018 05:07:07 +0000 (22:07 -0700)]
Formalize the context of a syntax error.

6 years agoImplement spar-not.
Chris Hanson [Mon, 26 Mar 2018 08:32:47 +0000 (01:32 -0700)]
Implement spar-not.

6 years agoRewrite COND-EXPAND to use spar rule.
Chris Hanson [Mon, 26 Mar 2018 02:13:33 +0000 (19:13 -0700)]
Rewrite COND-EXPAND to use spar rule.

6 years agoChange spars to set up error context when calling out to procedures.
Chris Hanson [Mon, 26 Mar 2018 00:05:17 +0000 (17:05 -0700)]
Change spars to set up error context when calling out to procedures.

6 years agoTweak CASE to use new keyword pattern.
Chris Hanson [Sun, 25 Mar 2018 15:49:44 +0000 (08:49 -0700)]
Tweak CASE to use new keyword pattern.

6 years agoRename spar-seq to spar-and.
Chris Hanson [Sun, 25 Mar 2018 15:46:54 +0000 (08:46 -0700)]
Rename spar-seq to spar-and.

6 years agoTweak spar patterns.
Chris Hanson [Sun, 25 Mar 2018 15:36:58 +0000 (08:36 -0700)]
Tweak spar patterns.

* Rename (quote <x>) to (noise <x>).
* Rename (keyword <id>) to (noise-keyword <id>).
* Implement (keyword <id>) that matches <id> and then pushes it.

6 years agoClarify that spar-push-if pushes the form, and spar-push-elt the elt.
Chris Hanson [Sun, 25 Mar 2018 15:31:23 +0000 (08:31 -0700)]
Clarify that spar-push-if pushes the form, and spar-push-elt the elt.

6 years agoRewrite CASE as a spar-transformer.
Chris Hanson [Sat, 24 Mar 2018 06:52:39 +0000 (23:52 -0700)]
Rewrite CASE as a spar-transformer.

6 years agoImplement spar-if and associated pattern.
Chris Hanson [Sat, 24 Mar 2018 06:04:15 +0000 (23:04 -0700)]
Implement spar-if and associated pattern.

6 years agoSimplify spars pattern language.
Chris Hanson [Sat, 24 Mar 2018 05:00:08 +0000 (22:00 -0700)]
Simplify spars pattern language.

Also change some of the terms to be clearer: I'm anticipating how the
documentation will read.

6 years agoEliminate parse-define-form.
Chris Hanson [Fri, 23 Mar 2018 06:51:23 +0000 (23:51 -0700)]
Eliminate parse-define-form.

6 years agoRewrite core of pattern compiler to use rules.
Chris Hanson [Fri, 23 Mar 2018 06:33:38 +0000 (23:33 -0700)]
Rewrite core of pattern compiler to use rules.

6 years agoImplement spar-arg:compare and (keyword id) pattern.
Chris Hanson [Fri, 23 Mar 2018 06:32:26 +0000 (23:32 -0700)]
Implement spar-arg:compare and (keyword id) pattern.

6 years agoMore macros converted to new model, plus a lot of fixes and tweaks.
Chris Hanson [Thu, 22 Mar 2018 07:10:25 +0000 (00:10 -0700)]
More macros converted to new model, plus a lot of fixes and tweaks.

6 years agoImplement syntax-constructor ("scons") mechanism.
Chris Hanson [Thu, 22 Mar 2018 04:16:07 +0000 (21:16 -0700)]
Implement syntax-constructor ("scons") mechanism.

This eliminates a potential problem with RSC and ER macros, which typically
construct ordinary list structure using quasiquote and renaming the keywords.
Unfortunately this will fail if the use environment has redefined the quasiquote
and/or quote keywords.  These constructors are careful not to use any keywords
except renamed ones; they also hide most of the renaming while providing a
simple procedural interface.

6 years agoHandle case where debugging-info has an old-style pathname.
Chris Hanson [Thu, 22 Mar 2018 03:52:29 +0000 (20:52 -0700)]
Handle case where debugging-info has an old-style pathname.

6 years agoDon't write pathnames into debugging info.
Chris Hanson [Thu, 22 Mar 2018 03:31:38 +0000 (20:31 -0700)]
Don't write pathnames into debugging info.

6 years agoImplement spar-top-level to cut down on boilerplate.
Chris Hanson [Thu, 22 Mar 2018 00:14:53 +0000 (17:14 -0700)]
Implement spar-top-level to cut down on boilerplate.

6 years agoTweak.
Chris Hanson [Wed, 21 Mar 2018 23:52:30 +0000 (16:52 -0700)]
Tweak.

6 years agoChange record predicate to check for child types. Reported by Arthur.
Chris Hanson [Wed, 21 Mar 2018 22:45:04 +0000 (15:45 -0700)]
Change record predicate to check for child types.  Reported by Arthur.

6 years agoMake record inheritance comply with SRFI 131.
Chris Hanson [Wed, 21 Mar 2018 08:50:54 +0000 (01:50 -0700)]
Make record inheritance comply with SRFI 131.

6 years agoImplement pattern language to make spars more terse.
Chris Hanson [Wed, 21 Mar 2018 07:40:16 +0000 (00:40 -0700)]
Implement pattern language to make spars more terse.

6 years agoAdd forgotten export.
Chris Hanson [Wed, 21 Mar 2018 05:53:32 +0000 (22:53 -0700)]
Add forgotten export.

6 years agoChange spar-match-null to a procedure.
Chris Hanson [Tue, 20 Mar 2018 05:34:31 +0000 (22:34 -0700)]
Change spar-match-null to a procedure.

6 years agoSimplify spar interface a bit more.
Chris Hanson [Mon, 19 Mar 2018 03:38:53 +0000 (20:38 -0700)]
Simplify spar interface a bit more.

6 years agoImplement record inheritance at Arthur's request.
Chris Hanson [Mon, 19 Mar 2018 03:10:00 +0000 (20:10 -0700)]
Implement record inheritance at Arthur's request.

6 years agoEliminate default-inits arg from make-record-type.
Chris Hanson [Sun, 18 Mar 2018 22:01:23 +0000 (15:01 -0700)]
Eliminate default-inits arg from make-record-type.

This will allow all optional args to be removed after 9.3.

6 years agoStreamline definition of record-type proxies.
Chris Hanson [Sat, 17 Mar 2018 23:42:40 +0000 (16:42 -0700)]
Streamline definition of record-type proxies.

6 years agoAllow a record to be both applicable and fasdumpable.
Chris Hanson [Sat, 17 Mar 2018 23:38:30 +0000 (16:38 -0700)]
Allow a record to be both applicable and fasdumpable.

6 years agoRestrict access to type proxies.
Chris Hanson [Sat, 17 Mar 2018 23:38:13 +0000 (16:38 -0700)]
Restrict access to type proxies.

6 years agoChange default value of repl:write-result-hash-numbers? as requested by GJS.
Chris Hanson [Sat, 17 Mar 2018 07:56:09 +0000 (00:56 -0700)]
Change default value of repl:write-result-hash-numbers? as requested by GJS.

6 years agoChange pathname representation to be a fasdumpable record.
Chris Hanson [Fri, 16 Mar 2018 05:52:45 +0000 (22:52 -0700)]
Change pathname representation to be a fasdumpable record.

6 years agoUse proxy instances for set-record-type-fasdumpable!.
Chris Hanson [Fri, 16 Mar 2018 05:52:24 +0000 (22:52 -0700)]
Use proxy instances for set-record-type-fasdumpable!.

6 years agoFix typo in previous change.
Chris Hanson [Fri, 16 Mar 2018 05:52:08 +0000 (22:52 -0700)]
Fix typo in previous change.

6 years agoImplement fasdumpable records.
Chris Hanson [Fri, 16 Mar 2018 05:28:31 +0000 (22:28 -0700)]
Implement fasdumpable records.

This is restricted to the runtime system since each type must have a
pre-allocated constant to represent it in the proxy table.

At the moment an applicable record can't be fasdumpable too.  That can be fixed
by teaching the microcode about the proxy mechanism, but for now it's not
necessary.

6 years agoIn pp, treat named list/vector specially.
Chris Hanson [Thu, 15 Mar 2018 04:37:56 +0000 (21:37 -0700)]
In pp, treat named list/vector specially.

6 years agoUse cached predicate dispatchers only where tagging is ubiquitous.
Chris Hanson [Thu, 15 Mar 2018 04:29:03 +0000 (21:29 -0700)]
Use cached predicate dispatchers only where tagging is ubiquitous.

6 years agoImplement applicable records.
Chris Hanson [Wed, 14 Mar 2018 05:54:25 +0000 (22:54 -0700)]
Implement applicable records.

6 years agoChange representation of dispatch tags to eliminated nested "extra" vector.
Chris Hanson [Tue, 13 Mar 2018 05:18:37 +0000 (22:18 -0700)]
Change representation of dispatch tags to eliminated nested "extra" vector.

6 years agoEliminate two unused procedures.
Chris Hanson [Wed, 7 Mar 2018 04:52:32 +0000 (20:52 -0800)]
Eliminate two unused procedures.

6 years agoGuarantee that capture-syntactic-environment preserves error context.
Chris Hanson [Wed, 7 Mar 2018 04:48:07 +0000 (20:48 -0800)]
Guarantee that capture-syntactic-environment preserves error context.

6 years agoSome more tweaks to the low-level macro interfaces.
Chris Hanson [Wed, 7 Mar 2018 02:26:54 +0000 (18:26 -0800)]
Some more tweaks to the low-level macro interfaces.

6 years agoImplement first two macros using syntax-parser.
Chris Hanson [Wed, 7 Mar 2018 01:47:16 +0000 (17:47 -0800)]
Implement first two macros using syntax-parser.

6 years agoMore tweaks to syntax-parser interface.
Chris Hanson [Wed, 7 Mar 2018 01:46:34 +0000 (17:46 -0800)]
More tweaks to syntax-parser interface.

6 years agoTweak interface for syntax-parser macros.
Chris Hanson [Wed, 7 Mar 2018 01:26:11 +0000 (17:26 -0800)]
Tweak interface for syntax-parser macros.

6 years agoRefactor syntax-low to improve support for spar transformers.
Chris Hanson [Sun, 4 Mar 2018 06:23:23 +0000 (22:23 -0800)]
Refactor syntax-low to improve support for spar transformers.

6 years agoEliminate a bunch of now-unused classifier procedures.
Chris Hanson [Sat, 3 Mar 2018 18:58:32 +0000 (10:58 -0800)]
Eliminate a bunch of now-unused classifier procedures.

6 years agoSplit compile-expr-item into expr and non-expr versions.
Chris Hanson [Thu, 1 Mar 2018 06:18:00 +0000 (22:18 -0800)]
Split compile-expr-item into expr and non-expr versions.

6 years agoAdd weak-pair support to equal?.
Chris Hanson [Wed, 28 Feb 2018 06:27:22 +0000 (22:27 -0800)]
Add weak-pair support to equal?.

6 years agoAdd call/cc as alias.
Chris Hanson [Wed, 28 Feb 2018 06:20:53 +0000 (22:20 -0800)]
Add call/cc as alias.

6 years agoAllow calling register-predicate! twice with the same args.
Chris Hanson [Wed, 28 Feb 2018 06:16:05 +0000 (22:16 -0800)]
Allow calling register-predicate! twice with the same args.

6 years agoPut back support for printing tagged lists and vectors when built by 9.2.
Chris Hanson [Fri, 23 Feb 2018 07:36:24 +0000 (23:36 -0800)]
Put back support for printing tagged lists and vectors when built by 9.2.

6 years agoMake sure that tagged vector/pair predicates are registered.
Chris Hanson [Thu, 22 Feb 2018 07:35:23 +0000 (23:35 -0800)]
Make sure that tagged vector/pair predicates are registered.

6 years agoChange compiled-code environments to be records.
Chris Hanson [Thu, 22 Feb 2018 07:34:53 +0000 (23:34 -0800)]
Change compiled-code environments to be records.

6 years agoPut error messages back into classifiers.
Chris Hanson [Wed, 21 Feb 2018 07:27:45 +0000 (23:27 -0800)]
Put error messages back into classifiers.

Also:
* Clean up spar API some more.
* Add spar-error for signalling errors.
* Add special args for specifying procedure args.

6 years agoRename spar-require-X to spar-match-X.
Chris Hanson [Wed, 21 Feb 2018 05:31:51 +0000 (21:31 -0800)]
Rename spar-require-X to spar-match-X.

6 years agoMake sure to flatten items in a body.
Chris Hanson [Wed, 21 Feb 2018 01:48:08 +0000 (17:48 -0800)]
Make sure to flatten items in a body.

6 years agoRewrite mit-syntax using syntax parsers.
Chris Hanson [Tue, 20 Feb 2018 07:13:39 +0000 (23:13 -0800)]
Rewrite mit-syntax using syntax parsers.

This is functionally equivalent except for error reporting.  Most syntax errors
will be "ill-formed syntax" with a form.  An future commit will tailor the
messages to be more informative.

This also breaks one syntax test, which will be fixed in the next commit.

6 years agoAnother round of changes to the spar API.
Chris Hanson [Tue, 20 Feb 2018 07:01:29 +0000 (23:01 -0800)]
Another round of changes to the spar API.

6 years agoFix thinko.
Chris Hanson [Mon, 19 Feb 2018 20:27:45 +0000 (12:27 -0800)]
Fix thinko.

6 years agoImplement spar-macro-transformer.
Chris Hanson [Mon, 19 Feb 2018 06:32:39 +0000 (22:32 -0800)]
Implement spar-macro-transformer.

6 years agoSplit transformer->expander procedures into internal and external.
Chris Hanson [Mon, 19 Feb 2018 06:01:22 +0000 (22:01 -0800)]
Split transformer->expander procedures into internal and external.

The external version takes a runtime environment as its closing env, while the
internal version takes a syntactic environment.

6 years agoMerge classifier and keyword items.
Chris Hanson [Mon, 19 Feb 2018 05:44:09 +0000 (21:44 -0800)]
Merge classifier and keyword items.

6 years agoA round of updates to the syntax parser.
Chris Hanson [Mon, 19 Feb 2018 05:13:18 +0000 (21:13 -0800)]
A round of updates to the syntax parser.

6 years agoAdd syntax-parser to runtime; not yet being used.
Chris Hanson [Sun, 18 Feb 2018 08:49:48 +0000 (00:49 -0800)]
Add syntax-parser to runtime; not yet being used.

6 years agoRefactor the syntax-error mechanism.
Chris Hanson [Thu, 15 Feb 2018 03:29:32 +0000 (19:29 -0800)]
Refactor the syntax-error mechanism.

* There's now a condition type for syntax errors.
* There's a distinction between errors that happen in macro expanders and those
  that happen inside the syntax implementation.
* All syntax errors now get the (form senv hist) objects.
* Syntax errors don't yet use the history to report context; that will come
  later.

6 years agoEliminate keyword-binder.
Chris Hanson [Thu, 15 Feb 2018 03:03:59 +0000 (19:03 -0800)]
Eliminate keyword-binder.

6 years agoMake field-names argument of condition-constructor be optional.
Chris Hanson [Thu, 15 Feb 2018 02:48:53 +0000 (18:48 -0800)]
Make field-names argument of condition-constructor be optional.

When that happens it uses the type's field-names value.

6 years agoSimplify slightly be introducing smap.
Chris Hanson [Wed, 14 Feb 2018 06:11:44 +0000 (22:11 -0800)]
Simplify slightly be introducing smap.

6 years agodecl-item doesn't need to be distinct from expr-item.
Chris Hanson [Wed, 14 Feb 2018 01:37:28 +0000 (17:37 -0800)]
decl-item doesn't need to be distinct from expr-item.

6 years agoMake sure history is correct for identifiers in declarations.
Chris Hanson [Tue, 13 Feb 2018 06:03:09 +0000 (22:03 -0800)]
Make sure history is correct for identifiers in declarations.

Plumb selectors through map-decl-ids and pass to procedure.

6 years agoReorganize cold-load for syntax.
Chris Hanson [Tue, 13 Feb 2018 05:24:32 +0000 (21:24 -0800)]
Reorganize cold-load for syntax.

* Rename syntax-transforms to syntax-low.
* Move expander-item to syntax-low.
* Don't load syntax-items early in cold load.
* Move compile-expr-item to syntax-items.

6 years agoBind classifiers directly into global environment.
Chris Hanson [Tue, 13 Feb 2018 04:50:20 +0000 (20:50 -0800)]
Bind classifiers directly into global environment.

Eliminates kludge of syntax-definitions.

6 years agoEliminate compile-body-item and simplify.
Chris Hanson [Mon, 12 Feb 2018 06:48:57 +0000 (22:48 -0800)]
Eliminate compile-body-item and simplify.

6 years agoMinor tweaks to classifiers.
Chris Hanson [Mon, 12 Feb 2018 06:20:27 +0000 (22:20 -0800)]
Minor tweaks to classifiers.

6 years agoRename classify-body to classify-forms-in-order.
Chris Hanson [Mon, 12 Feb 2018 06:05:52 +0000 (22:05 -0800)]
Rename classify-body to classify-forms-in-order.

Also have it return a list of items rather than a seq-item.