[plt-scheme] define-unit meaning in combinator-example.ss?

From: Larry Evans (cppljevans at suddenlink.net)
Date: Tue Jun 24 16:06:01 EDT 2008

While trying to understand:

   (define-unit lambda-calc
     ...)

in:

   plt/collects/combinator-parser/examples/combinator-example.ss

I first searched the index:

   /doc/guide/doc-index.html

for 'define-unit'.  Since it wasn't there, I thought maybe it was
defined in the current language.  Looking at the top of
*/combinator-example.ss, I saw:

   (require scheme/unit
          parser-tools/lex
          combinator-parser/combinator-unit)

So, I grep'ed the files scheme/unit and found:

find . -name \*.ss -exec grep -e 'define-unit' {} \; -ls
          (define-unit name imports exports elem ...))]))
16960391    4 -rw-r--r--   1 evansl   evansl       3302 Jun 13 20:50 
./unit/lang.ss

which, with more context, is:

(define-syntax (finish-a-unit stx)
   (syntax-case stx (import export)
     [(_ orig-stx name imports exports elem ...)
      #'(begin
          (provide name)
          (define-unit name imports exports elem ...))]))

So, I looked in the index to find that define-syntax defined:

doc/guide/pattern-macros.html#(part._define-syntax_and_syntax-rules)

however, there it's defined as:

     (define-syntax id

       (syntax-id-rules (literal-id ...)

         [pattern template]

         ...))

which doesn't seem to match the:


(define-syntax (finish-a-unit stx)

in ./unit/lang.ss since (finish-a-unit stx) does not match, AFAICT,
the id in '(define-syntax id'.

So, how can I figure out what the 'define-unit' in
combinator-example.ss means?

Any help is appreciated.


-regards,
Larry



Posted on the users mailing list.