-
Notifications
You must be signed in to change notification settings - Fork 2
/
c99.pir
80 lines (52 loc) · 1.28 KB
/
c99.pir
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# $Id$
# Copyright (C) 2008, Parrot Foundation.
=head1 TITLE
c99.pir - A C99 compiler.
=head2 Description
This is the base file for the C99 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 'C99'.
=head2 Functions
=over 4
=item onload()
Creates the C compiler using a C<PCT::HLLCompiler>
object.
=cut
.namespace [ 'C99';'Compiler' ]
.loadlib 'c99_group'
.sub 'onload' :anon :load :init
load_bytecode 'PCT.pbc'
$P0 = get_hll_global ['PCT'], 'HLLCompiler'
$P1 = $P0.'new'()
$P1.'language'('C99')
$P1.'parsegrammar'('C99::Grammar')
$P1.'parseactions'('C99::Grammar::Actions')
.end
=item main(args :slurpy) :main
Start compilation by passing any command line C<args>
to the C compiler.
=cut
.sub 'main' :main
.param pmc args
$P0 = compreg 'C99'
$P1 = $P0.'command_line'(args)
.end
.include 'src/gen_builtins.pir'
.include 'src/gen_grammar.pir'
.include 'src/gen_actions.pir'
.namespace [ 'C99';'Grammar' ]
.sub 'debug'
.param pmc match
.param pmc arg
.param pmc attrs :slurpy
printerr arg
printerr "\n"
.end
=back
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: