Skip to content
This repository
Newer
Older
100644 103 lines (65 sloc) 1.892 kb
5bb360e5 »
2008-01-21 Cardinal restart
1 =head1 TITLE
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
2
5bb360e5 »
2008-01-21 Cardinal restart
3 cardinal.pir - A cardinal compiler.
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
4
5bb360e5 »
2008-01-21 Cardinal restart
5 =head2 Description
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
6
5bb360e5 »
2008-01-21 Cardinal restart
7 This is the base file for the cardinal compiler.
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
8
5bb360e5 »
2008-01-21 Cardinal restart
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'.
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
12
5bb360e5 »
2008-01-21 Cardinal restart
13 =head2 Functions
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
14
5bb360e5 »
2008-01-21 Cardinal restart
15 =over 4
06b8a848 »
2006-07-30 [Cardinal] refactor to follow Perl6 AST/OST example
16
5bb360e5 »
2008-01-21 Cardinal restart
17 =item onload()
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
18
5bb360e5 »
2008-01-21 Cardinal restart
19 Creates the cardinal compiler using a C<PCT::HLLCompiler>
20 object.
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
21
5bb360e5 »
2008-01-21 Cardinal restart
22 =cut
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
23
51837928 »
2008-02-04 [cardinal]
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
5bb360e5 »
2008-01-21 Cardinal restart
36 .namespace [ 'cardinal::Compiler' ]
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
37
5bb360e5 »
2008-01-21 Cardinal restart
38 .loadlib 'cardinal_group'
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
39
5bb360e5 »
2008-01-21 Cardinal restart
40 .sub 'onload' :anon :load :init
41 load_bytecode 'PCT.pbc'
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
42
5bb360e5 »
2008-01-21 Cardinal restart
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')
51837928 »
2008-02-04 [cardinal]
48
65e22725 »
2008-02-04 [cardinal] add 'and' and 'or' operators.
49 $P1.'commandline_banner'("Cardinal - Ruby for the Parrot VM\n\n")
50 $P1.'commandline_prompt'('irb(main):001:0>')
51
51837928 »
2008-02-04 [cardinal]
52 ## create a list of END blocks to be run
53 $P0 = new 'List'
54 set_hll_global ['cardinal'], '@?END_BLOCKS', $P0
dedd006b »
2008-05-10 Variable assignment works in cardinal.
55
56 $P0 = new 'List'
57 set_hll_global ['cardinal';'Grammar';'Actions'], '@?BLOCK', $P0
362250e7 »
2006-10-02 [Cardinal] Closer to support for classes, blocking on .HLL bug
58 .end
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
59
5bb360e5 »
2008-01-21 Cardinal restart
60 =item main(args :slurpy) :main
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
61
5bb360e5 »
2008-01-21 Cardinal restart
62 Start compilation by passing any command line C<args>
63 to the cardinal compiler.
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
64
5bb360e5 »
2008-01-21 Cardinal restart
65 =cut
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
66
5bb360e5 »
2008-01-21 Cardinal restart
67 .sub 'main' :main
68 .param pmc args
4cfaaf2f »
2006-09-17 Cleanup and refactor for class support
69
5bb360e5 »
2008-01-21 Cardinal restart
70 $P0 = compreg 'cardinal'
71 $P1 = $P0.'command_line'(args)
51837928 »
2008-02-04 [cardinal]
72
73 .include 'iterator.pasm'
74 .local pmc iter
75 $P0 = get_hll_global ['cardinal'], '@?END_BLOCKS'
76 iter = new 'Iterator', $P0
77 iter = .ITERATE_FROM_END
78 iter_loop:
79 unless iter goto iter_end
80 $P0 = pop iter
81 $P0()
82 goto iter_loop
83 iter_end:
4cfaaf2f »
2006-09-17 Cleanup and refactor for class support
84 .end
85
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
86
5bb360e5 »
2008-01-21 Cardinal restart
87 .include 'src/gen_builtins.pir'
88 .include 'src/gen_grammar.pir'
89 .include 'src/gen_actions.pir'
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
90
51837928 »
2008-02-04 [cardinal]
91
92
5bb360e5 »
2008-01-21 Cardinal restart
93 =back
272b0b9e »
2006-07-19 languages/cardinal Initial checkin
94
95 =cut
9af68170 »
2007-04-10 [cardinal] Added emacs/vim coda as per coding standards
96
97 # Local Variables:
98 # mode: pir
99 # fill-column: 100
100 # End:
a5fb08e1 »
2008-02-18 [codingstd]
101 # vim: expandtab shiftwidth=4 ft=pir:
5bb360e5 »
2008-01-21 Cardinal restart
102
Something went wrong with that request. Please try again.