Pure Danger Tech


navigation
home

Factor and Parrot

03 Apr 2009

Last night, we had another great Lambda Lounge meeting. First, Kyle Cordes cranked up a talk on the Factor programming language. Kyle did a great job giving us the feel for the spirit of Factor without dropping the whole language on us. I was definitely impressed with the sparseness of the language and the flexibility of defining new syntax. There seems to be an awfully lot of cool stuff here to look into.

Some things I wrote down that were interesting or funny:

  • In Factor, words read and write to a stack (or at least have that appearance) which means that data flows forward in a statement like 3 4 + . shows the data flow. That’s similar to ’s in unix and as opposed to prefix in Lisp (+ 3 4) or even Java function calls where you pass the function name first. Of course, this is just a shallow view of what’s actually going on but it yields some nice properties.
  • Someone (Brian Gilstrap I think) asked about the relationship to “tuple math” and I heard someone in the back say, “it’s tuples all the way down” which was just a superb ad-lib. Kudos. :)
  • Had a good side talk about how sequences can be lazy if you want.
  • There are ways to use locals or other techniques to simulate local variables or infix notation or probably whatever else you want.

Check out Kyle’s handout for more info.

After that, Charles Sharp did a great talk on Parrot, which is the VM that has grown out of Perl 6. Hopefully I can get this straight. The Perl 6 spec is effectively defined as tests written in Perl 6. The sticking point was that they wanted to write the Perl 6 compiler in Perl 6 (classic compiler bootstrapping issue). Eventually, along came Audrey Tang, who wrote the Pugs project (in Haskell) which is a Perl 6 compiler, which allowed them to then bootstrap the work on the actual Perl 6 compiler, Rakudo. Did ya get that?

Parrot itself has a goal of being the VM to implement dynamic languages in and there are many languages being ported to it at this time. Parrot itself has no less than four separate ways to specify programs:

  • PIR = Parrot Intermediate Representation, a human friendly way to write assembly
  • PASM = Parrot Assembly
  • PAST = Parrot AST
  • Byte code

Charles went through some more detail on Parrot and it sounds pretty interesting. There are just a handful of core data types (integer, number, string, and PMC) where PMC is a polymorphic container that can handle anything else. PMCs are the key to allowing languages to interoperate by passing data through the VM. Reminded me a lot of stuff going on in Microsoft’s DLR and some of the meta-object protocol (MOP) stuff being done by Attila Szegedi and discussed on the jvm-languages group.

In retrospect, Charles bit off more than he could chew to handle both Parrot/Pugs/Rakudo and Perl 6 as the Perl 6 parts got a bit short-changed. I would happily see another whole talk just about Perl 6 which seems to have 78 amazing things shoved into it. I won’t even try to enumerate them here. Check out Charles’ slides for more.

All in all, a pair of awesome talks.