Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Parrot virtual machine
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Update|date=August 2022}} {{Short description|Software to run programming languages}} {{Infobox software | name = Parrot virtual machine | logo = Parrot Foundation logo.png | logo size = 220px | logo alt = Parrot Foundation logo | developer = | latest release version = 8.1.0 | latest release date = {{Start date and age|2016|02|16}}<ref name="Release Note">{{cite web | url = http://www.parrot.org/news/2016/Parrot-8.1.0 | title = New supported release 8.1.0 "Andean Parakeet" | publisher = Parrot Foundation | date = 2016-02-16 | access-date = 2016-09-26 }}</ref> | discontinued = yes | replaced_by = [[MoarVM]] (for Raku) | operating system = [[Cross-platform]] | programming language = [[C (programming language)|C]] | genre = [[Virtual machine]] | license = [[Artistic License]] 2.0 | website = {{official URL}} }} '''Parrot''' is a discontinued [[register machine|register-based]] [[process virtual machine]] designed to run [[dynamic language]]s efficiently. It is possible to compile [[Parrot assembly language]] and [[Parrot intermediate representation]] (PIR, an intermediate language) to Parrot [[bytecode]] and execute it. Parrot is [[free software|free]] and [[Open-source software|open-source]] software.<ref name="opensource">{{cite web|url=http://www.parrot.org/files/parrot_cla.pdf|title=Parrot Contributor License Agreement 1.0|publisher=Parrot Foundation|access-date=2009-03-18|archive-date=2010-08-16|archive-url=https://web.archive.org/web/20100816130045/http://www.parrot.org/files/parrot_cla.pdf|url-status=dead}}</ref> Parrot was started by the [[Perl]] community and developed with help from the [[free software community|open-source and free software communities]]. As a result, it was focused on [[license compatibility]] with Perl ([[Artistic License|Artistic License 2.0]]), platform compatibility across a broad array of systems, processor architecture compatibility across most modern processors, speed of execution, small size (around 700k depending on platform), and the flexibility to handle the varying demands made by [[Raku (programming language)|Raku]] and other modern [[dynamic language]]s. Version 1.0, with a stable [[application programming interface]] (API) for development, was released on March 17, 2009.<ref name="version1">{{cite web | url = https://trac.parrot.org/parrot/report/14 | title = Parrot Roadmap | publisher = Parrot Foundation | date = 2008-11-20 | access-date = 2008-11-20 | archive-date = 2010-04-15 | archive-url = https://web.archive.org/web/20100415195108/http://trac.parrot.org/parrot/report/14 | url-status = dead }}</ref> The last version is release 8.1.0 "Andean Parakeet".<ref name="Release Note" /> Parrot was officially discontinued in August 2021, after being supplanted by [[MoarVM]] in its main use (Raku) and never becoming a mainstream VM for any of its other supported languages.<ref name="inactive-parrot">{{cite web |title=Inactive Parrot {{!}} Parrot VM |url=http://www.parrot.org/news/inactive-parrot |website=www.parrot.org}}</ref> ==History== The name ''Parrot'' came from an [[April Fool's]] joke which announced a hypothetical language, named ''Parrot'', that would unify [[Python (programming language)|Python]] and [[Perl]].<ref>{{cite web|url=http://www.oreilly.com/news/parrotstory_0401.html |title=The Story Behind the Parrot Prank - O'Reilly Media |publisher=Oreilly.com |date=2001-04-06 |access-date=2014-02-25}}</ref><ref>{{cite web |url=http://www.perl.com/pub/a/2001/04/01/parrot.htm |title=Programming Parrot |publisher=Perl.com |access-date=2014-02-25 |url-status=dead |archive-url=https://web.archive.org/web/20100718195724/http://www.perl.com/pub/a/2001/04/01/parrot.htm |archive-date=2010-07-18 }}</ref> The name was later adopted by the Parrot project (initially a part of the Raku development effort) which aimed to support Raku, Python, and other programming languages. The Parrot Foundation was dissolved in 2014.<ref>{{Cite web|title=Corporations Advanced Search|url=https://ccfs.sos.wa.gov/|access-date=2021-04-09|website=Washington State Department of Licensing|id=UBI 602 839 536}}</ref> The Foundation was created in 2008 to hold the [[copyright]] and [[trademark]]s of the Parrot project, to help drive development of [[Programming language implementation|language implementations]] and the core codebase, to provide a base for growing the Parrot community, and to reach out to other language communities.<ref>[http://www.parrotblog.org/2008/06/announcing-parrot-foundation.html Announcing the Parrot Foundation] {{webarchive |url=https://web.archive.org/web/20080629020838/http://www.parrotblog.org/2008/06/announcing-parrot-foundation.html |date=June 29, 2008 }}</ref> Historical design decisions are documented in the form of Parrot Design Documents, or PDDs, in the Parrot repository.<ref>{{cite web|url=http://docs.parrot.org/parrot/latest/html/pdds.html |title=Parrot 6.1.0 - Parrot Design Documents (PDDs) |publisher=Docs.parrot.org |access-date=2014-02-25}}</ref> 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.<ref>{{cite web|last=Otto |first=Christoph |url=http://reparrot.blogspot.com/2010/10/parrot-has-new-architect-what-now.html |title=reparrot: Parrot has a new architect. What now? |publisher=Reparrot.blogspot.com |date=2010-10-21 |access-date=2014-02-25}}</ref> ==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 structure]]s between languages. ===Static and dynamic languages=== The differing properties of [[Type checking|statically and dynamically typed]] languages motivated the design of Parrot. Current popular virtual machines such as the [[Java virtual machine]] and the [[Common Language Runtime]] (for the [[.NET]] platform) have been designed for statically typed languages, while the languages targeted by Parrot are dynamically typed. Virtual machines such as the Java virtual machine and the current Perl 5 virtual machine are also [[Stack machine|stack-based]]. Parrot developers chose a register-based design, reasoning that it more closely resembles a hardware design, allowing the vast literature on [[compiler optimization]] to be used in generating bytecode for the Parrot virtual machine that could run at speeds closer to [[machine code]].{{cn|date=November 2023}} Other register-based virtual machines inspired parts of Parrot's design, including [[LLVM]], the [[Lua (programming language)#Internals|Lua VM]] and Inferno's [[Dis virtual machine|Dis]]. ==={{Anchor|PMC}}Functional concepts=== Parrot has rich support for several features of [[functional programming]] including [[Closure (computer science)|closures]] and [[continuation]]s, both of which can be particularly difficult to implement correctly and portably, especially in conjunction with [[exception handling]] and [[thread (computer science)|threading]]. The biggest advantage is the dynamic extendability of objects with methods, which allows for ''polymorphic containers'' (PMCs) and associated [[opcode]]s. Implementing solutions to these problems at the virtual machine level obviates the need to solve them in the individual client languages. ===Compiler tools=== {{Main|Parser Grammar Engine}} <!-- note: once [[Parrot compiler toolchain]] exists, that should be the main link --> Parrot provides a suite of [[Parrot compiler toolchain|compiler-writing tools]]<ref>[http://docs.parrot.org/parrot/latest/html/docs/book/ch04_compiler_tools.pod.html] {{webarchive|url=https://web.archive.org/web/20090509161210/http://docs.parrot.org/parrot/latest/html/docs/book/ch04_compiler_tools.pod.html|date=May 9, 2009}}</ref> 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 (programming language)|Lua]] and a new language called "Winxed".<ref>{{cite web|url=http://www.parrot.org/languages|title=Languages - Parrot VM |publisher=parrot.org |access-date=2023-11-18}}</ref> Projects to implement many other languages were started, including [[PHP]], [[Python (programming language)|Python]], and [[Ruby (programming language)|Ruby]]; along with esoteric and demonstration languages such as [[Befunge]] and the "[[Wikibooks:Parrot Virtual Machine/Squaak Tutorial|squaak]]" tutorial language.<ref>{{cite web|url=https://trac.parrot.org/parrot/wiki/Languages |title=Languages β Parrot |publisher=Parrot development wiki |access-date=2023-11-18}}</ref> None of these projects were successful in becoming the primary implementation of their respective languages.<ref name="inactive-parrot" /> ==Internals== There are three forms of program code for Parrot: * ''[[Bytecode]]''<ref>{{Cite web |url=http://www.parrotcode.org/docs/parrotbyte.html |title=The Parrot Bytecode (PBC) Format - parrotcode |access-date=2009-07-15 |archive-date=2008-12-24 |archive-url=https://web.archive.org/web/20081224061126/http://www.parrotcode.org/docs/parrotbyte.html |url-status=dead }}</ref> 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 [[Compiler|compile]]s down to bytecode. PASM code is usually stored in files with the filename extension ".pasm". * ''[[Parrot intermediate representation]]'' (PIR<ref>[http://docs.parrot.org/parrot/latest/html/docs/book/ch03_pir.pod.html] {{webarchive|url=https://web.archive.org/web/20090720034439/http://docs.parrot.org/parrot/latest/html/docs/book/ch03_pir.pod.html|date=July 20, 2009}}</ref>) 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 [[Central processing unit|CPUs]], and unlike most virtual machines, which are stack-based. Parrot provides four types of registers: * I: native [[integer]] type * N: [[floating-point arithmetic|floating-point]] numbers * S: advanced [[String (computer science)|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 <syntaxhighlight lang="asm"> 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 </syntaxhighlight> In PIR <syntaxhighlight lang="perl6"> .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 </syntaxhighlight> ==mod_parrot== '''mod_parrot''' is an optional module for the [[Apache HTTP Server|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== {{Portal|Free and open-source software}} * [[MoarVM]] * [[GraalVM]] * [[Common Language Runtime]] (CLR) * [[Comparison of application virtual machines]] * [[Da Vinci Machine]] ==References== {{Reflist|30em}} ==External links== * {{official website|www.parrot.org}} * [http://perl6.cz/wiki/Perl_6_and_Parrot_links Perl 6 and Parrot links] *For mod_parrot: ** {{cite web | url = http://www.parrot.org/mod_parrot | title = Mod_parrot website | work = parrot.org | publisher = Jeff Horwitz | access-date = 2023-08-18 }} ** {{cite web | url = http://www.perl.com/pub/a/2004/12/22/mod_parrot.html | title = Introducing mod_parrot | first = Jeff | last = Horwitz | authorlink = Jeff Horwitz | date = December 22, 2004 | work = perl.com | publisher = [[O'Reilly Media]] }} ** {{cite web| url = http://perlcast.com/2008/06/03/jeff-horwitz-on-mod_parrot/| title = Jeff Horwitz on mod_parrot| accessdate = 2008-06-09| author = Josh McAdams| date = June 3, 2008| work = Perlcast| publisher = Perlcast.com| archive-url = https://web.archive.org/web/20080907074501/http://perlcast.com/2008/06/03/jeff-horwitz-on-mod_parrot/| archive-date = 2008-09-07| url-status=dead}} {{Perl}} [[Category:Cross-platform software]] [[Category:Free and open source interpreters]] [[Category:Free software programmed in C]] [[Category:Perl]] [[Category:Register-based virtual machines]] [[Category:Software using the Artistic license]] [[Category:Discontinued software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Cite web
(
edit
)
Template:Cn
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Main
(
edit
)
Template:Main other
(
edit
)
Template:Official website
(
edit
)
Template:Perl
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)
Template:Update
(
edit
)
Template:Webarchive
(
edit
)