3 cardinal.pir - A cardinal compiler.
7 This is the base file for the cardinal compiler.
9 This file includes the parsing and grammar rules from
10 the src/ directory, loads the relevant PGE libraries,
11 and registers the compiler under the name 'cardinal'.
19 Creates the cardinal compiler using a C<PCT::HLLCompiler>
27 .include 'src/gen_builtins.pir'
29 .sub 'onload' :anon :load :init
30 $P0 = subclass 'ResizablePMCArray', 'List'
38 .namespace [ 'cardinal::Compiler' ]
40 .loadlib 'cardinal_group'
42 .sub 'onload' :anon :load :init
43 load_bytecode 'PCT.pbc'
44 .local pmc cardinalmeta
45 cardinalmeta = get_hll_global ['CardinalObject'], '!CARDINALMETA'
46 cardinalmeta.'new_class'('cardinal::Compiler', 'parent'=>'PCT::HLLCompiler')
48 $P0 = get_hll_global ['PCT'], 'HLLCompiler'
50 $P1.'language'('cardinal')
51 $P1.'parsegrammar'('cardinal::Grammar')
52 $P1.'parseactions'('cardinal::Grammar::Actions')
54 $P1.'commandline_banner'("Cardinal - Ruby for the Parrot VM\n\n")
55 $P1.'commandline_prompt'('crb(main):001:0>')
57 ## create a list of END blocks to be run
59 set_hll_global ['cardinal'], '@?END_BLOCKS', $P0
62 set_hll_global ['cardinal';'Grammar';'Actions'], '@?BLOCK', $P0
64 $P1 = get_hll_global ['PAST::Compiler'], '%valflags'
65 $P1['CardinalString'] = 'e'
68 =item main(args :slurpy) :main
70 Start compilation by passing any command line C<args>
71 to the cardinal compiler.
78 ## create ARGS global.
80 args = new 'CardinalArray'
81 iter = new 'Iterator', args_str
84 unless iter goto args_end
89 set_hll_global 'ARGS', args
91 $P0 = compreg 'cardinal'
92 $P1 = $P0.'command_line'(args_str)
94 .include 'iterator.pasm'
95 $P0 = get_hll_global ['cardinal'], '@?END_BLOCKS'
96 iter = new 'Iterator', $P0
97 iter = .ITERATE_FROM_END
99 unless iter goto iter_end
107 .include 'src/gen_grammar.pir'
108 .include 'src/parser/quote_expression.pir'
109 .include 'src/gen_actions.pir'
121 # vim: expandtab shiftwidth=4 ft=pir: