Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Perl 6 Deep Dive
  • Table Of Contents Toc
Perl 6 Deep Dive

Perl 6 Deep Dive

By : Shitov
3 (4)
close
close
Perl 6 Deep Dive

Perl 6 Deep Dive

3 (4)
By: Shitov

Overview of this book

Perl is a family of high-level, general-purpose, interpreted, dynamic programming languages consisting of Perl 5 and Perl 6. Perl 6 helps developers write concise and declarative code that is easy to maintain. This book is an end-to-end guide that will help non-Perl developers get to grips with the language and use it to solve real-world problems. Beginning with a brief introduction to Perl 6, the first module in the book will teach you how to write and execute basic programs. The second module delves into language constructs, where you will learn about the built-in data types, variables, operators, modules, subroutines, and so on available in Perl 6. Here the book also delves deeply into data manipulation (for example, strings and text files) and you will learn how to create safe and correct Perl 6 modules. You will learn to create software in Perl by following the Object Oriented Paradigm. The final module explains in detail the incredible concurrency support provided by Perl 6. Here you will also learn about regexes, functional programming, and reactive programming in Perl 6. By the end of the book, with the help of a number of examples that you can follow and immediately run, modify, and use in practice, you will be fully conversant with the benefits of Perl 6.
Table of Contents (15 chapters)
close
close

Compilers

During the process of Perl 6 development, a number of compilers were created. Some of them were just a playground to test some ideas, whereas some were more mature. Among the most important, we should mention the following four projects:

  • Parrot
  • Pugs
  • Perlito
  • Rakudo

There were more attempts to create a Perl 6 compiler, which were less successful or less complete. We will go through the preceding list to see the highlights of each project and then focus on Rakudo, which is the compiler you should use today.

Parrot

Parrot is the first virtual machine aimed to be the base of the Perl 6 compiler. The initial design of the language suggested that the source code is compiled to the bytecode, which is executed by the virtual machine. Parrot's goal was to create a virtual machine suitable for handling all the needs of Perl 6 from simple data types, such as integers, to more complicated structures, such as classes, with the ability to call methods on objects and follow the object hierarchy.

The project is available at parrot.org. After some time, Parrot started supporting other programming languages, such as Lua or Python, and the virtual machine became less focused on Perl 6 itself. For example, the Ponie project was an attempt to create a compiler that would execute Perl 5 programs using Parrot.

Parrot became one of the virtual machines inside another project, Rakudo. However, before we go to Rakudo, let's follow the historical path and talk about Pugs.

Pugs

Pugs (Perl User's Golfing System) is a Perl 6 compiler written in Haskell. It was started in 2005 by a sole developer and soon attracted more people to the team. Pugs was the most sophisticated compiler of its time. It was difficult and very time consuming to compile the project, the execution speed was low, but the quality of the compilation and the coverage of Perl 6 specification were outstanding.

Pugs main role in Perl 6 as of today is the vast test suite. It was created to test Pugs itself, but turned out to be an official test suite for Perl 6. A compiler that claims to call itself a Perl 6 compiler must pass the test suite tests.

Pugs are not developing anymore, but its source code is available on GitHub at https://github.com/perl6/Pugs.hs.

Perlito

Perlito is another very interesting example of a project of building a Perl 6 compiler. It was aimed at cross-compiling Perl 5 or Perl 6 to one of these languages—JavaScript, Java, Go, Python, Ruby, or Lisp. You can find the project's repository at https://github.com/fglock/Perlito.

Perlito offers a web interface to compile the subset of Perl 6 in the browser. It compiles the code in Perl 6 to JavaScript and executes it immediately. This page is available at http://fglock.github.io/Perlito/perlito/perlito6.html. This project covers the Perl 6 specification only partially, but it may still be used to create various online educational systems for both Perl 5 and 6.

Rakudo

Rakudo is a compiler initially built on the Parrot virtual machine. Later, it started using the Java Virtual Machine (JVM), but in the end, the developers of Parrot created their own virtual machine, MoarVM (Metamodel on a Runtime Virtual Machine (www.moarvm.org)). Currently, the support of JVM is limited, and the main virtual machine is MoarVM.

Rakudo itself is a Perl 6 compiler. For us, the most useful compiler is Rakudo Star, which is a distribution including the compiler as well as a number of Perl 6 modules and a few command-line tools, such as a module installer. In this book, we will use the Rakudo Star compiler to run programs in Perl 6.

Rakudo's website is rakudo.org.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Perl 6 Deep Dive
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon