1. riffraff
  2. shakespeare-parrot


shakespeare-parrot / shakespeare.pir

=head1 TITLE

shakespeare.pir - A shakespeare compiler.

=head2 Description

This is the base file for the shakespeare compiler.

This file includes the parsing and grammar rules from
the src/ directory, loads the relevant PGE libraries,
and registers the compiler under the name 'shakespeare'.

=head2 Functions

=over 4

=item onload()

Creates the shakespeare compiler using a C<PCT::HLLCompiler>


.namespace [ 'shakespeare';'Compiler' ]

.loadlib 'shakespeare_group'

.sub 'onload' :anon :load :init
    .local pmc p6meta
    load_bytecode 'PCT.pbc'

    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
    $P1 = $P0.'new'()

    p6meta = new 'P6metaclass'
    $P0 = p6meta.'new_class'('shakespeare::Compiler', 'parent'=>'PCT::HLLCompiler')
    $P1 = $P0.'new'()
    $P1.'addstage'('lc', 'before'=>'parse')

.sub 'lc' :method
    .param string source
    .param pmc adverbs         :slurpy :named

    downcase source
    .return (source)

=item main(args :slurpy)  :main

Start compilation by passing any command line C<args>
to the shakespeare compiler.


.sub 'main' :main
    .param pmc args

    $P0 = compreg 'shakespeare'
    $P1 = $P0.'command_line'(args)

.include 'src/gen_builtins.pir'
.include 'src/gen_grammar.pir'
.include 'src/gen_actions.pir'



# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: