EtusivuHae koulutuksiaRakudo Perl 6 and NQP Internals

Rakudo Perl 6 and NQP Internals

This workshop offers a deep dive into Rakudo Perl 6 and NQP. The main focus is on the backend independent parts but also with some focus on the JVM and the upcoming MoarVM. During the training, participants build their own little compiler, complete with a simple class-based object system, to help them understand how the tool chain works.

Perl 6 is finally here! Get the most relevant and important skills and information from Jonathan Worthington from Edument who has been actively involved in the development of the Rakudo Perl 6 Compiler, as well as the language itself.


Koulutusmuoto
Classroom

Kesto
2 päivää

Hinta
1550 €

Target Group

Programmers who are curious about the Perl 6 internals and how the compiler works. The course is also interesting for those who want to learn compiler creation in general.

Prerequisites

Reasonable knowledge of Perl 6 language. Experience with NQP is helpful.

Contents of Rakudo Perl 6 and NQP Internals

Day 1
Overview: Compiler, and NQP/Rakudo-architecture

  • Role of the compilers
  • Perl 6 challenges
  • NQP as a language
  • NQP as a toolbox for building compilers 
  • QAST
  • Operations in nqp::
  • Bootstrapping in a nutshell
  • How Rakudo uses NQP

NQP Language

  • Designgoals
  • Literals, variables, and control structures
  • Subroutines, pointy blocks, closure semantics
  • Classes, attributes, classes, and methods
  • Regexps and grammar
  • Roles
  • Multiple dispatch
  • Builtin commands and nqp::-operations
  • Exception handling
  • Limitations and other differences from the full-fledged Perl 6
  • Shortcomings

Compiling

  • Class HLL::Compiler
  • Frontends, backends, and QAST in between
  • Grammar based parsing, AST building with documents
  • Code generation
  • Build a small language from scratch

QAST

  • QAST::Node, base of everything
  • Overall structure of AST
  • Literals: QAST::IVal, QAST::NVal and QAST::SVal
  • Operations: QAST::Op, basic example
  • Sequencing: QAST::Stmts, QAST::Stmt
  • Variables: QAST::Var, QAST::VarWithFallback, scope, decl, value
  • Block-symbol table
  • Calls
  • Parameters and arguments
  • Contextualisation: QAST::Want
  • Block references: QAST::BVal
  • Object references: QAST::WVal
  • Backend escape hatch: QAST::VM
  • On top QAST::CompUnit

A closer look at nqp::-operationerna

  • Arithmetic
  • Comparisons
  • Containers
  • Strings
  • Control flow
  • Exception related
  • Context introspection
  • Big integers


Day 2
6model

  • Object: behavior + state
  • Types and varieties
  • Meta object
  • Representations
  • Stables
  • knowhow, the root of everything
  • Building a simple object system from scratch
  • Adding items to our new little language, with a World
  • Method caches
  • Tycp checking
  • Booling
  • Calls
  • Explore NQPs metaobject
  • Explore Rakudos metaobject
  • Working with the container

Limited serialization and module handling

  • Compilation phase vs. run phase
  • Serialization contexts
  • QAST::WVal recap
  • What is "limited" in it
  • Takeback, conflicts and other nasty issues
  • nqp::-operations in relation to serialization contexts
  • World recap
  • How module loading works

Regex- and grammar engine

  • QAST::Regex node and its sub types
  • Cursor and Match
  • Two stacks: bstack and cstack
  • NFA:s and the longest token matching

JVM backend

  • Description of the JVM
  • QAST-to-JAST-translation
  • Run time support library

MoarVM backend

  • Description of the MoarVM
  • QAST-to-MAST-translation

Schedule

Course begins at 9.00 and ends at 16.-16.30. Breakfast is served from 8.15 onwards.