[<<][staapl][>>][..]
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^
  ((prefix-parsers
    (macro)
    ((p3) (+ + +)))))


;; In pic18.ss context:
box> (syntax->datum (expand #'(macro: p3)))
(#%app
 make-word
 (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^
  (macro/plus
   (prefix-parsers
    (macro)
    ((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
signature?

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
interfaces.




[Reply][About]
[<<][staapl][>>][..]