Sunday, April 22, 2012

ochre

Copperbox revision 2740.

I've added RelOps and if-then-else to the Expression syntax (both top level and K Normal form), though they still need accommodating in the Csound code generator. The Csound code generator now needs a rethink...

ochre

Copperbox revision 2739.

I've restarted ochre taking the code from micro-ochre. micro-ochre will stay small as there is still a lot of work outstanding, include designing a type system.

So far, Ochre adds binary operators to the Expression data types.

micro-ochre

Copperbox revisions 2737 & 2738.

I've changed the rewrite passes to use explicit environments rather than use a combined monad wrapping the Fresh monad with a Reader. Using Reader wasn't simplifying the code enough.

(Not committed...) I went down something of a rabbit hole adding Lam and App to the top-level syntax. The idea was to allow modularization in the instruments that would be compiled out with inline expansion (Csound has nothing to readily compile user-specified procedures into). However the implementation wasn't very good - new rewrite rules could throw errors if the syntax wasn't right and I wasn't sure if I'd accounted for all the possibly valid translations. As the language will be embedded in Haskell I think I can just use Haskell (the meta-language) for abstraction.

If I'm successful with micro-ochre, I have plans for a version of Wumpus with user-level procedural abstraction to tackle the current code explosion in the generated PostScript. In this case I don't think I will want inline expansion either as I want the smallest code possible.

Friday, April 20, 2012

micro-ochre

Copperbox revision 2736.

micro-ochre a genuine EDSL compiler - it optimizes! - that works!

micro-ochre generates Csound instruments. Just two opcodes - oscil and out - are supported, but the compiler uses a "proper" intermediate representation (K Normal Form) and it does genuine optimizations (const folding, beta-reduction, useless let elimination). The final codegen is flaky but it generates the test instrument and that instrument works.

Depending how you count I first started working on this 10 years ago (generating RTCmix with PLT Scheme), so although the success comes with heavy caveats, I'm pleased.

Tuesday, April 17, 2012

Cont ML

Copperbox revision 2735.

I've now implemented the tail CPS transformation.

I think there might be a mistake in the paper "Compiling with Continuations, Continued" - the CPS transformation in Figure 8 uses syntax for lambda abstraction which is present in the untyped CPS syntax but not in the typed syntax in Figure 7. I've added Abs to the Val type in my implementation.

Cont ML

Copperbox revision 2724.

Initial work on an implementation of the Mini ML in Andrew Kennedy's "Compling with Continuations, Continued" paper.

Although I'm working on the larger typed language, I might avoid typing. I've written the parser and pretty printer, I haven't tackled the CPS transform yet.

Sunday, April 15, 2012

copperbox updates

Updates to Copperbox...

Revision 2730 - added zformat, formatting combinators with an interface like pretty print combinators but no prettiness i.e. no fitting / line breaking.

Revision 2731 - added directory-script. This should replace directory-diff, however I'm not sure if I have a use-case to work on this project any more, so it might get punted to the long grass as it currently stands.

Revisions 2732 & 2733 - renaming hpj-pretty-expr to pretty-expr-hpj and reorganizing the source directories.

I've done quite a bit of work over the last fortnight, but I haven't felt like committing it until today. I had a processor meltdown this morning (the fan on the processor needs the contact "glue" re-applying) so I thought I better finally make a commit.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.