Pugs Apocryphon 2: Architecture - Reason of Pugs - make Perl 6 programs run - Explain the Perl6 parts more; assume no Haskell - What is the difference between how Perl 5 and Perl 6 runs programs? - Separate parse/compilation/runtime phase - What does the Parser do? - match the source with regexes defined in Perl 6 Grammar - which is just a set of regexes to match language parts - does not check "1=2" or any other compile time errors - either parses into syntax tree, or report syntax error - the syntax tree may be completely bogus - What does the Compiler do? - decide the "meaning" of syntax trees - translate various special forms into the same underlying operations - What is "PIL"? - Pugs Intermediate Language - very few node types - Verbs: Apply (function call), Assign, Bind (give new name) - Nouns: Literals, Expression - expression: inline assembly, variables, thunks, code - (explain the PIL forms more, with examples) - Why "PIL"? - doesn't care how program was "written", only what it "means" - Don't program in PIL because it's very verbose - But it represents anything Perl programs can do - It only has five operations (also known as "nodes") - The PIL evaluator - At this moment is the reference implementation of how Perl 6 works - Will eventually be written entirely in Perl 6 - Will be one of the many backends in the end, among Parrot, Perl 5, and others - The Code generator - translates PIL operations into target languages - the underlying language still have to provide a runtime and builtin functions