Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 97 lines (61 sloc) 1.675 kb
5bb360e @tewk Cardinal restart
tewk authored
1 =head1 TITLE
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
2
5bb360e @tewk Cardinal restart
tewk authored
3 cardinal.pir - A cardinal compiler.
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
4
5bb360e @tewk Cardinal restart
tewk authored
5 =head2 Description
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
6
5bb360e @tewk Cardinal restart
tewk authored
7 This is the base file for the cardinal compiler.
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
8
5bb360e @tewk Cardinal restart
tewk authored
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'.
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
12
5bb360e @tewk Cardinal restart
tewk authored
13 =head2 Functions
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
14
5bb360e @tewk Cardinal restart
tewk authored
15 =over 4
06b8a84 @tewk [Cardinal] refactor to follow Perl6 AST/OST example
tewk authored
16
5bb360e @tewk Cardinal restart
tewk authored
17 =item onload()
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
18
5bb360e @tewk Cardinal restart
tewk authored
19 Creates the cardinal compiler using a C<PCT::HLLCompiler>
20 object.
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
21
5bb360e @tewk Cardinal restart
tewk authored
22 =cut
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
23
5183792 @kjs [cardinal]
kjs authored
24
25 .namespace
26
27 .sub 'onload' :anon :load :init
28 $P0 = subclass 'ResizablePMCArray', 'List'
29 .end
30
31 .namespace [ 'List' ]
32
33
34
35
5bb360e @tewk Cardinal restart
tewk authored
36 .namespace [ 'cardinal::Compiler' ]
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
37
5bb360e @tewk Cardinal restart
tewk authored
38 .loadlib 'cardinal_group'
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
39
5bb360e @tewk Cardinal restart
tewk authored
40 .sub 'onload' :anon :load :init
41 load_bytecode 'PCT.pbc'
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
42
5bb360e @tewk Cardinal restart
tewk authored
43 $P0 = get_hll_global ['PCT'], 'HLLCompiler'
44 $P1 = $P0.'new'()
45 $P1.'language'('cardinal')
46 $P1.'parsegrammar'('cardinal::Grammar')
47 $P1.'parseactions'('cardinal::Grammar::Actions')
5183792 @kjs [cardinal]
kjs authored
48
49 ## create a list of END blocks to be run
50 $P0 = new 'List'
51 set_hll_global ['cardinal'], '@?END_BLOCKS', $P0
362250e @tewk [Cardinal] Closer to support for classes, blocking on .HLL bug
tewk authored
52 .end
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
53
5bb360e @tewk Cardinal restart
tewk authored
54 =item main(args :slurpy) :main
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
55
5bb360e @tewk Cardinal restart
tewk authored
56 Start compilation by passing any command line C<args>
57 to the cardinal compiler.
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
58
5bb360e @tewk Cardinal restart
tewk authored
59 =cut
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
60
5bb360e @tewk Cardinal restart
tewk authored
61 .sub 'main' :main
62 .param pmc args
4cfaaf2 @tewk Cleanup and refactor for class support
tewk authored
63
5bb360e @tewk Cardinal restart
tewk authored
64 $P0 = compreg 'cardinal'
65 $P1 = $P0.'command_line'(args)
5183792 @kjs [cardinal]
kjs authored
66
67 .include 'iterator.pasm'
68 .local pmc iter
69 $P0 = get_hll_global ['cardinal'], '@?END_BLOCKS'
70 iter = new 'Iterator', $P0
71 iter = .ITERATE_FROM_END
72 iter_loop:
73 unless iter goto iter_end
74 $P0 = pop iter
75 $P0()
76 goto iter_loop
77 iter_end:
4cfaaf2 @tewk Cleanup and refactor for class support
tewk authored
78 .end
79
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
80
5bb360e @tewk Cardinal restart
tewk authored
81 .include 'src/gen_builtins.pir'
82 .include 'src/gen_grammar.pir'
83 .include 'src/gen_actions.pir'
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
84
5183792 @kjs [cardinal]
kjs authored
85
86
5bb360e @tewk Cardinal restart
tewk authored
87 =back
272b0b9 @tewk languages/cardinal Initial checkin
tewk authored
88
89 =cut
9af6817 @paultcochrane [cardinal] Added emacs/vim coda as per coding standards
paultcochrane authored
90
91 # Local Variables:
92 # mode: pir
93 # fill-column: 100
94 # End:
95 # vim: expandtab shiftwidth=4:
5bb360e @tewk Cardinal restart
tewk authored
96
Something went wrong with that request. Please try again.