Shevek (shevek) wrote,
Shevek
shevek

It's finally dawned on me that what I'm trying to do is to write a compiler and interpreter for a fully parallel programming language. Every statement executes simultaneously. Perhaps with this realization, the job will become easier. The trouble is that a background in lambda calculus doesn't really prepare one for this kind of job. I've never done much pi calculus, and I've never used a language like the one I'm trying to build, so I'm sure I'm making a lot of old mistakes.

Any pointers?

Funnily enough, bytecoding the thing is easy. Interpreting it is fairly easy. Defining accurate semantics for the operators is a total bastard. Semantics which worked perfectly well when I thought it was sequential simply don't work in the parallel case because the concept of "termination" of an operator has gone away. You don't know when you've finished evaluating an operator. But I need that concept in order to print the result. So I'm redefining the time-extent of an operator in terms of active resources and doing the resource management manually (a bloody pain) so that when an instance has no active resources, it considers itself terminated.

This means reference counting, which is hard work, and hard to make exception-safe, because when you're parallel, you don't necessarily "return" down the same stack you went up, so finally-constructs don't work. There has to be a better way.
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 5 comments