[racket-dev] match syntax-parse

From: stefan.israelsson at se.abb.com (stefan.israelsson at se.abb.com)
Date: Fri May 11 09:45:49 EDT 2012


I have done two interseting things.

1. Ported syntax-parse over to guile.
2. Implemented racket's match completely with the help of syntax parse.

Comments about 1.

I found that the lack of possibility to define two syntax classes that 
referese to each other inferior to what 
can be done although I understand the choice of to do this and if you 
define one hugh syntax class and use
syntax class parameters you will be able to implement any feature still 
but at the drawback that one need
to define one hugh syntax class.

i propose instead to add syntax-class-set! and syntax-splicing-class-set! 
that has the following logic:
1. Compile all the meta data for the class as before
2. there has to be an already defined syntax class, the declaration, which 
has a logically identical set of meta data except for 
    the parser function
3. If there is no syntax class defined, error about it
4. If there the interfaces miss-matches print out what is different.
5. if everything is ok then set! the old named parser to the new parser

With this logic one can have mutually recursively defined syntax classes 
in different files a boon if I have a say.

Also I have this working in a test case (the match parser)

So theory looks kind of nice what's the problems!

I must say that syntax-parse rocks and I would suggest that we implement 
the racket matcher completely with syntax parse.
To see how it can look like consider looking at the file at,


Please look at this tomorrow CET I have a new version ready soon with 
interesting addons.

The benefit: is much more hackable codebase then the current match 
code-base, it's smaller for one thing.
The drawback: one must change syntax-parse to not use match code. I would 
say that this is not
that hugh investment though. And that one introduces buggs.

Then a final question:
Should we consider implementing syntax-parse with the help of 

Have fun!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120511/82a78eb8/attachment.html>

Posted on the dev mailing list.