Reviving the CLU project

kag on 2004-03-19T00:23:10

A few months ago I tried to write a CLU compiler for parrot (for no better reason than nostalgia for my undergraduate days). I got bogged down in trying to figure out a not-horribly-complex way to implement parameterized clusters, so on the shelf it went.

Parrot has progressed a lot since then. So it's time to take CLU off the shelf and dust it off a bit. The Parse::RecDescent parser is still mostly good. (I need to wrap my brain around PRD's error reporting. Compilers really should report syntax errors rather than just exiting.) I'll probably port to Perl6::Rules when they're done.

The code generation was definitely in the "build one to throw away" category. So out it goes. This time I'm going to output an AST to feed to the not-yet-existant ast2imc layer of Parrot. I can spit out ASTs for statements in either YAML or s-expressions. (More complex constructs awaiting me deciding how scopes are handled.) The sexprs lose some of the metadata.

Google finds several intentions to write a YAML library for Parrot, but no code. The only firm AST stuff for Parrot is Leo's YAL, which is in C. (Subgoal of mine: avoid C.) But at the rate I'm devoting time to my little toy, that probably isn't a problem.