Thu Mar 17 00:34:44 EDT 2011

Prefix parsers part of signatures

Ha damn it, it works!  After adding some glue and a dummy unit to
export the signature, this is the sig def and an expansion test:

(require "../rpn/rpn-signature-forms.ss")
(define-signature prefix-test^
    ((p3) (+ + +)))))

;; In pic18.ss context:
box> (syntax->datum (expand #'(macro: p3)))
 (lambda (p)
   (let-values (((p) (#%app (#%top . macro/+) p)))
     (let-values (((p) (#%app (#%top . macro/+) p)))
       (let-values (((p) (#%app (#%top . macro/+) p))) p)))))

Nope that's not yet correct.  The `+' is not visible in the signature
and needs to be made part of the signature.  I moved to this:

(define-signature prefix-test^
    ((plus3) (plus plus plus)))))

And a trivial plug in the unit def:

(import stack^)  ;; for macro/+
(export prefix-test^)
(define (macro/plus s) (macro/+ s))

This isn't quite right.  I mean, it works, but it's clumsy.  The names
like `plus' leak into the namespace.  It would be better if this
didn't need to add aliases.  Can `import' or `open' be used in the

What about this: use two interfaces.  One that lists the deps and
another that extends this sig with macros.

What I really want is a simple way to bundle things, make unions of