“What is the tortoise standing on?”
“You’re very clever, young man, very clever,” said the old lady. “But it’s turtles all the way down!”
This chapter details the architecture and internal workings of Parrot, the interpreter behind Perl 6. Parrot is a register-based, bytecode-driven, object-oriented, multithreaded, dynamically typed, self-modifying, asynchronous interpreter. While that’s an awful lot of buzzwords, the design fits together remarkably well.
Three main principles drive the design of Parrot—speed, abstraction, and stability.
Speed is a paramount concern. Parrot absolutely must be as fast as possible, since the engine effectively imposes an upper limit on the speed of any program running on it. It doesn’t matter how efficient your program is or how clever your program’s algorithms are if the engine it runs on limps along. While Parrot can’t make a poorly written program run fast, it could make a well-written program run slowly, a possibility we find entirely unacceptable.
Speed encompasses more than just raw execution time. It extends to resource usage. It’s irrelevant how fast the engine can run through its bytecode if it uses so much memory in the process that the system spends half its time swapping to disk. While we’re not averse to using resources to gain speed benefits, we try not to use more than we need, and to share what we do use.
Abstraction indicates that things are designed ...