Friday, August 19, 2011

Parrot virtual machine

This is something interesting I came across. I have been studing Virtual Machines and what's out there beside the Java JVM and the ancient Pcode from CPM days.  There is also LLVM, so now I just learned about Parrot when searching about Allison Randal who's name came up related to Ubuntu.



http://en.wikipedia.org/wiki/Parrot_virtual_machine


Parrot is a register-based process virtual machine designed to run dynamic languages efficiently. It uses just-in-time compilation for speed to reduce the interpretation overhead. It is currently possible to compile Parrot assembly language and PIR (an intermediate language) to Parrot bytecode and execute it. Parrot is free and open source software.[2]

Parrot was started by the Perl community and is developed with help from the open source and free software communities.

There is a book on it
Parrot Developer's Guide

Parrot is a language-neutral virtual machine for dynamic languages such as Ruby, Python, PHP, and Perl. It hosts a powerful suite of compiler tools tailored to dynamic languages and a next generation regular expression engine. Its architecture is fundamentally different than virtual machines such as the JVM or CLR, with optimizations for dynamic languages, the use of registers instead of stacks, and pervasive continuations used for all flow control.

This book covers Parrot Intermediate Representation (PIR), Parrot's native low-level language. PIR is  fundamentally an assembly language, but it has some higher-level features such as operator syntax, syntactic sugar for subroutine and method calls, automatic register allocation, and more friendly conditional syntax. Parrot libraries -- including most of Parrot's compiler tools -- are often written in PIR. Even so, PIR is more rigid and "close to the machine" than higher-level languages, which makes it a good window into the inner workings of the virtual machine.

No comments: