[toronto-lisp] help deciphering Scheme macro(s)

Paul Tarvydas paultarvydas at gmail.com
Tue Feb 19 17:56:33 UTC 2013


I'm converting this PEG parser from R5RS scheme to CL:

http://dev.lshift.net/tonyg/json-scheme/

I'm having trouble (I think) deciphering how the following macro is 
expanded (esp. the 2nd line "(#t alternative) ...")

...

    ((_ #f "alt" nt body ((/ alternative ...) rest ...))
      (packrat-check (packrat-parser #f "alts" nt (#t alternative) ...)
		    (lambda (result) (packrat-parser #f "alt" nt body (rest ...)))))

...

Let's say the input is something simple, such as "...((x <- #\y (/ #\a 
#\b)) x) ... " (i.e. parse a 'y' followed by an 'a' or a 'b', assign 'y' 
to the variable x, then return that variable x).

Does someone know how to "read" this macro?

Or, can someone tell me the exact steps in getting any working 
implementation of R5RS scheme up on linux (mint/ubuntu/debian) or Win7 
and display the expanded macro?  (I seem to hit confusing roadblocks 
with racket, chicken, cpscm+scm2lisp).

Thanks
pt




More information about the toronto-lisp mailing list