Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Бағдарламалау тілдерін іске қосуға арналған бағдарламалық қамтамасыз ету.
Software to run programming languages
Parrot – динамикалық тілдерді тиімді іске қосу үшін жасалған, қазіргі кезде қолданыстан тоқтатылған, тіркелімге негізделген процесс виртуалды машинасы. Parrot тіліндегі ассемблер мен Parrot аралық өрнегін (PIR, аралық тіл) Parrot байт-кодына компиляциялап, оны іске қосу мүмкін. Parrot – еркін және ашық кодты бағдарламалық қамтамасыз ету. Parrot-ты Perl қауымдастығы бастады және ашық кодты және еркін бағдарламалық қамтамасыз ету қауымдастықтарының көмегімен дамытылды. Осының нәтижесінде, Perl лицензиясымен (Artistic License 2.0) үйлесімділік, жүйелердің кең ауқымында платформалық үйлесімділік, көптеген заманауи процессорларда процессорлық архитектураның үйлесімділігі, орындалу жылдамдығы, кішкентай көлем (платформаға байланысты шамамен 700 килобайтқа дейін) және Raku және басқа да заманауи динамикалық тілдердің әртүрлі талаптарына бейімделуге назар аударылды. 2009 жылдың 17 наурызында тұрақты қолданбалы бағдарламалау интерфейсі (API) бар 1.0 нұсқасы жарық көрді. Соңғы нұсқасы – 8.1.0 "Андийлік конго".
Parrot is a discontinued register based process virtual machine designed to run dynamic languages 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 and open source software. Parrot was started by the Perl community and developed with help from the open source and free software communities. As a result, it was focused on license 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 by Raku and other modern dynamic languages. Version 1.0, with a stable application programming interface (API) for development, was released on March 17, 2009. The last version is release 8.1.0 "Andean Parakeet".
Тарих
Parrot атауы Python және Perl-ді біріктіретін Parrot деп аталатын гипотетикалық тіл туралы сәуір айында жасалған әзілден туындаған. Кейіннен бұл атау Parrot жобасы қабылдады (бастапқыда Raku әзірлеу жұмысының бір бөлігі), ол Raku, Python және басқа да бағдарламалау тілдерін қолдау мақсатын қойды. Parrot қоры 2014 жылы таратылды. Parrot қоры 2008 жылы Parrot жобасының авторлық құқықтары мен тауарлық белгілерін сақтау, тілдік іске асырулар мен негізгі код базасын дамытуға көмектесу, Parrot қауымдастығының өсуіне негіз жасау және басқа тілдердің қауымдастықтарымен байланыс орнату үшін құрылды. Тарихи жобалау шешімдері Parrot Design Documents немесе PDD нысанында Parrot репозиторийінде құжатталған. 2005 жылдың соңына дейін Дэн Сугальски Parrot-тың бас дизайнері және бас архитектор болды. Perl, Linux ядросы және C++ хакері ретінде танымал Чип Салценберг 2006 жылдың ортасына дейін басшылықты өз қолына алды, содан кейін ол жетекші әзірлеуші болды. Punie-нің жетекші әзірлеушісі және Parrot компилятор құралдарының бас архитектор болған Алисон Рэндал 2010 жылдың қазан айының ортасына дейін бас архитектор қызметін атқарды, содан кейін ол орнынан бас тартып, Кристоф Оттоны жаңа бас архитектор етіп тағайындады.
The name Parrot came from an April Fool's joke which announced a hypothetical language, named Parrot, that would unify Python and Perl. 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. 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. Historical design decisions are documented in the form of Parrot Design Documents, or PDDs, in the Parrot repository. 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.
Тілдер
Parrot виртуалды машинасының мақсаты клиенттік тілдерді қолдау және олардың бір-бірімен өзара жұмыс істеуіне мүмкіндік беру болды. Бұл мақсатқа жетуде бірнеше қиындықтар бар, әсіресе тілдер арасында жоғары деңгейдегі түсініктерді, деректерді және деректер құрылымдарын үйлестірудің қиындығы.
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.
Статикалық және динамикалық тілдер
Статикалық және динамикалық типтегі тілдердің өзгеше қасиеттері Parrot дизайнының туындауына себеп болды. Қазіргі танымал виртуалды машиналар, мысалы Java виртуалды машинасы және .NET платформасы үшін Common Language Runtime, статикалық типтелген тілдерге арналған, ал Parrot-тың қолдануға арналған тілдері динамикалық типтелген. Java виртуалды машинасы және қазіргі Perl 5 виртуалды машинасы сияқты виртуалды машиналар да стекке негізделген. Parrot әзірлеушілері аппараттық құрылымға жақындығы үшін регистрлік дизайнды таңдады, бұл компиляторды оңтайландыру бойынша кең көлемді әдебиетті пайдаланып, Parrot виртуалды машинасы үшін машиналық кодқа жақын жылдамдықпен орындала алатын байт-кодты жасауға мүмкіндік береді. Басқа регистрлік виртуалды машиналар, соның ішінде LLVM, Lua VM және Inferno's Dis, Parrot дизайнының кейбір бөліктеріне әсер етті.
The differing properties of 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 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. Other register based virtual machines inspired parts of Parrot's design, including LLVM, the Lua VM and Inferno's Dis.
Функционалдық ұғымдар
Parrot функционалдық бағдарламалаудың бірнеше мүмкіндіктерін толық қолдайды, соның ішінде жабылулар мен жалғастыруларды. Бұлардың екеуін де дұрыс және платформалар бойынша үйлесімді жүзеге асыру, әсіресе қателерді өңдеу және көп жіптілікпен бірге қолдану кезінде қиын болуы мүмкін. Ең маңызды артықшылығы – объектілерді әдістермен динамикалық түрде кеңейту мүмкіндігі, бұл полиморфты контейнерлерге (PMC) және олармен байланысты операциялық кодтарға (опкодтарға) жол ашады. Виртуалды машина деңгейінде осы мәселелерді шешу, клиенттік тілдердің әрқайсысында оларды жеке шешу қажеттілігін жояды.
Parrot has rich support for several features of functional programming including closures and continuations, both of which can be particularly difficult to implement correctly and portably, especially in conjunction with exception handling and threading. The biggest advantage is the dynamic extendability of objects with methods, which allows for polymorphic containers (PMCs) and associated opcodes. Implementing solutions to these problems at the virtual machine level obviates the need to solve these problems in the individual client languages.
Компилятор құралдары
Parrot компилятор құру құралдары жиынтығын ұсынады, оның ішінде Parser Grammar Engine (PGE) – гибридті парсер генераторы бар, ол рекурсивті түсу парсерін де, оператор басымдылығы парсерін де қолдана алады, сонымен қатар бір грамматикада екеуінің арасында еркін өтуге мүмкіндік береді. PGE ағаш грамматикасы қозғалтқышына (TGE) дерек жібереді, ол PGE жасаған синтаксистік ағашты оңтайландыру және соңында кодты генерациялау үшін одан әрі өңдейді.
Parrot provides a suite of compiler writing tools 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.
Қолданылу
Parrot VM-ге бағытталған ең толық тілдік іске асырылымдар Raku (сол кезде Rakudo Perl 6 деп аталған), Lua және "Winxed" деп аталған жаңа тіл болды. PHP, Python және Ruby сияқты көптеген басқа тілдерді іске асыру жобалары да басталды; сондай-ақ, Befunge және "squaak" оқу тілі сияқты эзотерикалық және демонстрациялық тілдер де болды. Бұл жобалардың ешқайсысы сәйкес тілдерінің негізгі іске асырылымына айнала алмады. Ол екілік форматта болып табылады және тікелей Parrot-пен интерпретацияланады. Байт-код әдетте ".pbc" кеңейтімді файлдарда сақталады. Parrot тілдік ассамблері (PASM) – байт-кодқа дейін компиляцияланатын төменгі деңгейдегі тіл. PASM коды әдетте ".pasm" кеңейтімді файлдарда сақталады. Parrot аралық өрнегі (PIR) PASM-ге қарағанда біршама жоғары деңгейдегі тіл және ол да байт-кодқа дейін компиляцияланады. Бұл тілдік іске асырылымдардың негізгі мақсаты болып табылады. PIR Parrot-тың процедуралық шақыру конвенцияларын ашық түрде басқарады, жақсартылған синтаксис, регистрлерді бөлу және тағы да басқа мүмкіндіктерді ұсынады. PIR коды әдетте ".pir" кеңейтімді файлдарда сақталады.
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". 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. None of these projects were successful in becoming the primary implementation of their respective languages. 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) 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".