Monday, March 06, 2006

Redex is cool

I hadn't looked at PLT Redex since its pre-publication days, but yesterday I started using it to implement my draft model for Topsl, the programming language for implementing online surveys. I couldn't believe how easy it was! I expected it to take quite a while, but within an hour I had a working operational model of core Scheme, and half an hour later I had the entire grammar of Topsl and even a few nice abstractions. I haven't quite finished the implementation yet, but it's been surprisingly painless.

Of course, it helps to have a good understanding of macrological* pattern-matching and template instantiation, capture-avoiding substitution, and Felleisen-style context-sensitive reduction semantics, so you might say I'm uniquely suited to use the tool. Regardless, I'm very impressed.

* This is a very silly adjective. Please don't ever use it. Someone could get hurt.

3 comments:

Sam Tobin-Hochstadt said...

Wait, I thought the PLT-Redex pattern matching was match.ss-based, rather than macrological.

And yes, I wrote this comment just to use the word "macrological".

Dave Herman said...

It uses match.ss, yes, but I meant that it uses a macrological (cough) style. The "term" form is like "syntax", and redex has automatic template variable substitution that's more like syntax-rules than unquoting.

Robby Findler said...

I just came across this, but I wanted to point out that redex's pattern matcher uses match.ss to parse the patterns (for the purpose of compiling them), but that's it. The pattern matcher itself is different than match.ss's; it produces all possible matches for things with, say, repeated ellipses. Plus, it draws from grammars that might be ambiguous, etc.