Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Parrot virtual machine

From Wikipedia, the free encyclopedia
(Redirected fromMod parrot)
This article needs to beupdated. Please help update this article to reflect recent events or newly available information.(August 2022)
Software to run programming languages
Parrot virtual machine
Parrot Foundation logo
Final release
8.1.0 / February 16, 2016; 9 years ago (2016-02-16)[1]
Repository
Written inC
Operating systemCross-platform
SuccessorMoarVM (for Raku)
TypeVirtual machine
LicenseArtistic License 2.0
Websitewww.parrot.orgEdit this at Wikidata

Parrot is a discontinuedregister-basedprocess virtual machine designed to rundynamic languages efficiently. It is possible to compileParrot assembly language andParrot intermediate representation (PIR, an intermediate language) to Parrotbytecode and execute it. Parrot isfree andopen-source software.[2]

Parrot was started by thePerl community and developed with help from theopen-source and free software communities. As a result, it was focused onlicense compatibility with Perl (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 byRaku and other moderndynamic languages.

Version 1.0, with a stableapplication programming interface (API) for development, was released on March 17, 2009.[3] The last version is release 8.1.0 "Andean Parakeet".[1] Parrot was officially discontinued in August 2021, after being supplanted byMoarVM in its main use (Raku) and never becoming a mainstream VM for any of its other supported languages.[4]

History

[edit]

The nameParrot came from anApril Fool's joke which announced a hypothetical language, namedParrot, that would unifyPython andPerl.[5][6] 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.[7] The Foundation was created in 2008 to hold thecopyright andtrademarks of the Parrot project, to help drive development oflanguage 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 ofPunie 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

[edit]

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, anddata structures between languages.

Static and dynamic languages

[edit]

The differing properties ofstatically and dynamically typed languages motivated the design of Parrot. Current popular virtual machines such as theJava virtual machine and theCommon 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 alsostack-based. Parrot developers chose a register-based design, reasoning that it more closely resembles a hardware design, allowing the vast literature oncompiler optimization to be used in generating bytecode for the Parrot virtual machine that could run at speeds closer tomachine code.[citation needed] Other register-based virtual machines inspired parts of Parrot's design, includingLLVM, theLua VM and Inferno'sDis.

Functional concepts

[edit]

Parrot has rich support for several features offunctional programming includingclosures andcontinuations, both of which can be particularly difficult to implement correctly and portably, especially in conjunction withexception handling andthreading. The biggest advantage is the dynamic extendability of objects with methods, which allows forpolymorphic containers (PMCs) and associatedopcodes. Implementing solutions to these problems at the virtual machine level obviates the need to solve them in the individual client languages.

Compiler tools

[edit]
Main article:Parser Grammar Engine

Parrot provides a suite ofcompiler-writing tools[11] which includes theParser Grammar Engine (PGE), a hybrid parser-generator that can express arecursive descent parser as well as anoperator-precedence parser, allowing free transition between the two in a single grammar. The PGE feeds into theTree Grammar Engine (TGE) which further transforms the parse-tree generated by PGE for optimization and ultimately for code generation.

Implementations

[edit]

The most complete language implementations targeting the Parrot VM wereRaku (known at the time as Rakudo Perl 6),Lua andWinxed.[12] Projects to implement many other languages were started, includingPHP,Python, andRuby; along with esoteric and demonstration languages such asBefunge and the "squaak" tutorial language.[13] None of these projects were successful in becoming the primary implementation of their respective languages.[4]

Internals

[edit]

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 thefilename extension ".pbc".
  • Parrot assembly language (PASM) is the low level language thatcompiles 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

[edit]

Registers

[edit]

Parrot is register-based like most hardwareCPUs, and unlike most virtual machines, which are stack-based. Parrot provides four types of registers:

Parrot provides an arbitrary number of registers; this number is fixed at compile time per subroutine.

Arithmetic operations

[edit]

In PASM

setI1,4incI1# I1 is now 5addI1,2# I1 is now 7setN1,42.0decN1# N1 is now 41.0subN1,2.0# N1 is now 39.0printI1print','printN1print"\n"end

In PIR

 .sub'main' :main$I1 =4inc$I1# $I1 is now 5$I1 +=2# $I1 is now 7$N1 =42.0dec$N1# $N1 is now 41.0$N1 -=2.0# $N1 now 39.0print$I1print', 'print$N1print"\n" .end

mod_parrot

[edit]

mod_parrot is an optional module for theApache 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 inParrot assembly language, or any high-level language targeted to Parrot.

See also

[edit]

References

[edit]
  1. ^ab"New supported release 8.1.0 "Andean Parakeet"". Parrot Foundation. 2016-02-16. Retrieved2016-09-26.
  2. ^"Parrot Contributor License Agreement 1.0"(PDF). Parrot Foundation. Archived fromthe original(PDF) on 2010-08-16. Retrieved2009-03-18.
  3. ^"Parrot Roadmap". Parrot Foundation. 2008-11-20. Archived fromthe original on 2010-04-15. Retrieved2008-11-20.
  4. ^ab"Inactive Parrot | Parrot VM".www.parrot.org.
  5. ^"The Story Behind the Parrot Prank - O'Reilly Media". Oreilly.com. 2001-04-06. Retrieved2014-02-25.
  6. ^"Programming Parrot". Perl.com. Archived fromthe original on 2010-07-18. Retrieved2014-02-25.
  7. ^"Corporations Advanced Search".Washington State Department of Licensing. UBI 602 839 536. Retrieved2021-04-09.
  8. ^Announcing the Parrot FoundationArchived June 29, 2008, at theWayback Machine
  9. ^"Parrot 6.1.0 - Parrot Design Documents (PDDs)". Docs.parrot.org. Retrieved2014-02-25.
  10. ^Otto, Christoph (2010-10-21)."reparrot: Parrot has a new architect. What now?". Reparrot.blogspot.com. Retrieved2014-02-25.
  11. ^[1]Archived May 9, 2009, at theWayback Machine
  12. ^"Languages - Parrot VM". parrot.org. Retrieved2023-11-18.
  13. ^"Languages – Parrot". Parrot development wiki. Archived fromthe original on 2010-06-04. Retrieved2023-11-18.
  14. ^"The Parrot Bytecode (PBC) Format - parrotcode". Archived fromthe original on 2008-12-24. Retrieved2009-07-15.
  15. ^[2]Archived July 20, 2009, at theWayback Machine

External links

[edit]
Things
Frameworks
Software
Related
Books
People
Retrieved from "https://en.wikipedia.org/w/index.php?title=Parrot_virtual_machine&oldid=1324656401#mod_parrot"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp