Parrot virtual machine
This article needs to be updated.(August 2022) |
Final release | 8.1.0
/ February 16, 2016[1] |
---|---|
Repository | |
Written in | Cross-platform |
Successor | MoarVM (for Raku) |
Type | Virtual machine |
License | Artistic License 2.0 |
Website | www |
Parrot is a discontinued
Parrot was started by the
Version 1.0, with a stable
History
The name Parrot came from an
The Parrot Foundation was dissolved in 2014.[7] The Foundation was created in 2008 to hold the copyright and trademarks of the Parrot project, to help drive development of language implementations and the core codebase, to provide a base for growing the Parrot community, and to reach out to other language communities.[8]
Historical design decisions are documented in the form of Parrot Design Documents, or PDDs, in the Parrot repository.[9]
Until late 2005, Dan Sugalski was the lead designer and chief architect of Parrot. Chip Salzenberg, a longtime Perl, Linux kernel, and C++ hacker, took over until mid-2006, when he became the lead developer. Allison Randal, the lead developer of Punie and chief architect of Parrot's compiler tools, was the chief architect until mid-October 2010 when she stepped down and chose Christoph Otto as the new chief architect.[10]
Languages
The goal of the Parrot virtual machine was to host client languages and allow inter-operation between them. Several hurdles exist in accomplishing this goal, in particular the difficulty of mapping high-level concepts, data, and data structures between languages.
Static and dynamic languages
The differing properties of
Virtual machines such as the Java virtual machine and the current Perl 5 virtual machine are also
Functional concepts
Parrot has rich support for several features of
Compiler tools
Parrot provides a suite of compiler-writing tools[11] which includes the Parser Grammar Engine (PGE), a hybrid parser-generator that can express a recursive descent parser as well as an operator-precedence parser, allowing free transition between the two in a single grammar. The PGE feeds into the Tree Grammar Engine (TGE) which further transforms the parse-tree generated by PGE for optimization and ultimately for code generation.
Implementations
The most complete language implementations targeting the Parrot VM were Raku (known at the time as Rakudo Perl 6), Lua and a new language called "Winxed".[12] Projects to implement many other languages were started, including PHP, Python, and Ruby; along with esoteric and demonstration languages such as Befunge and the "squaak" tutorial language.[13] None of these projects were successful in becoming the primary implementation of their respective languages.[4]
Internals
There are three forms of program code for Parrot:
- Bytecode[14] is binary and is natively interpreted by Parrot. Bytecode is usually stored in files with the filename extension ".pbc".
- Parrot assembly language (PASM) is the low level language that compiles down to bytecode. PASM code is usually stored in files with the filename extension ".pasm".
- Parrot intermediate representation (PIR[15]) is a slightly higher level language than PASM and also compiles down to bytecode. It is the primary target of language implementations. PIR transparently manages Parrot's inter-routine calling conventions, provides improved syntax, register allocation, and more. PIR code is usually stored in files with the filename extension ".pir".
Examples
Registers
Parrot is register-based like most hardware CPUs, and unlike most virtual machines, which are stack-based. Parrot provides four types of registers:
- I: native integer type
- N: floating-point numbers
- S: advanced string registers with Unicode support
- P: PMC, or Polymorphic Container — Parrot object type
Parrot provides an arbitrary number of registers; this number is fixed at compile time per subroutine.
Arithmetic operations
In PASM
set I1, 4
inc I1 # I1 is now 5
add I1, 2 # I1 is now 7
set N1, 42.0
dec N1 # N1 is now 41.0
sub N1, 2.0 # N1 is now 39.0
print I1
print ', '
print N1
print "\n"
end
In PIR
.sub 'main' :main
$I1 = 4
inc $I1 # $I1 is now 5
$I1 += 2 # $I1 is now 7
$N1 = 42.0
dec $N1 # $N1 is now 41.0
$N1 -= 2.0 # $N1 now 39.0
print $I1
print ', '
print $N1
print "\n"
.end
mod_parrot
mod_parrot is an optional module for the Apache web server. It embeds a Parrot virtual machine interpreter into the Apache server and provides access to the Apache API to allow handlers to be written in Parrot assembly language, or any high-level language targeted to Parrot.
See also
- MoarVM
- GraalVM
- Common Language Runtime (CLR)
- Comparison of application virtual machines
- Da Vinci Machine
References
- ^ a b "New supported release 8.1.0 "Andean Parakeet"". Parrot Foundation. 2016-02-16. Retrieved 2016-09-26.
- ^ "Parrot Contributor License Agreement 1.0" (PDF). Parrot Foundation. Archived from the original (PDF) on 2010-08-16. Retrieved 2009-03-18.
- ^ "Parrot Roadmap". Parrot Foundation. 2008-11-20. Archived from the original on 2010-04-15. Retrieved 2008-11-20.
- ^ a b "Inactive Parrot | Parrot VM". www.parrot.org.
- ^ "The Story Behind the Parrot Prank - O'Reilly Media". Oreilly.com. 2001-04-06. Retrieved 2014-02-25.
- ^ "Programming Parrot". Perl.com. Archived from the original on 2010-07-18. Retrieved 2014-02-25.
- ^ "Corporations Advanced Search". Washington State Department of Licensing. UBI 602 839 536. Retrieved 2021-04-09.
- ^ Announcing the Parrot Foundation Archived June 29, 2008, at the Wayback Machine
- ^ "Parrot 6.1.0 - Parrot Design Documents (PDDs)". Docs.parrot.org. Retrieved 2014-02-25.
- ^ Otto, Christoph (2010-10-21). "reparrot: Parrot has a new architect. What now?". Reparrot.blogspot.com. Retrieved 2014-02-25.
- ^ [1] Archived May 9, 2009, at the Wayback Machine
- ^ "Languages - Parrot VM". parrot.org. Retrieved 2023-11-18.
- ^ "Languages – Parrot". Parrot development wiki. Retrieved 2023-11-18.
- ^ "The Parrot Bytecode (PBC) Format - parrotcode". Archived from the original on 2008-12-24. Retrieved 2009-07-15.
- ^ [2] Archived July 20, 2009, at the Wayback Machine
External links
- Official website
- Perl 6 and Parrot links
- For mod_parrot:
- "Mod_parrot website". parrot.org. Jeff Horwitz. Retrieved 2023-08-18.
- Horwitz, Jeff (December 22, 2004). "Introducing mod_parrot". perl.com. O'Reilly Media.
- Josh McAdams (June 3, 2008). "Jeff Horwitz on mod_parrot". Perlcast. Perlcast.com. Archived from the original on 2008-09-07. Retrieved 2008-06-09.