tagged release 0.7.1
[parrot.git] / languages / eclectus / driver_nqp.pir
blob516db335fcb667dd51fabf6de606bb1c5b8efb10
1 # $Id$
3 # The dynamics PMCs used by Eclectus are loaded
4 .loadlib 'eclectus_group'
6 # for devel
7 .include 'library/dumper.pir'
9 .namespace []
11 .sub '__onload' :init
12     load_bytecode 'PGE.pbc'
13     load_bytecode 'PGE/Text.pbc'
14     load_bytecode 'PGE/Util.pbc'
15     load_bytecode 'PGE/Dumper.pbc'
16     load_bytecode 'PCT.pbc'
18     load_bytecode 'languages/eclectus/src/builtins/all.pbc'
19 .end
22 .sub drive :main
24     .param pmc argv
26     .local string program_name, nqp_fn
27     program_name = shift argv
28     nqp_fn       = shift argv
30     # compile NQP to PIR
31     .local string pir_fn, cmd
32     .local int ret
33     clone pir_fn, nqp_fn
34     substr pir_fn, -3, 3, 'pir'
35     cmd = "../../parrot ../../compilers/nqp/nqp.pbc --target=pir --output="
36     concat cmd, pir_fn
37     concat cmd, " "
38     concat cmd, nqp_fn
39     # say cmd
40     ret = spawnw cmd
42     # load the generated PIR
43     $S1 = concat "languages/eclectus/", pir_fn
44     load_bytecode $S1
46     .local pmc stmts
47     ( stmts ) = scheme_entry()
49     # compile and evaluate the PAST returned from scheme_entry()
50     .local pmc past_compiler
51     past_compiler = new [ 'PCT::HLLCompiler' ]
52     $P0 = split ' ', 'post pir'
53     past_compiler.'stages'( $P0 )
54     $P1 = past_compiler.'eval'(stmts)
55     #_dumper ($P1)
56     $P0 = split ' ', 'evalpmc'
57     past_compiler.'stages'( $P0 )
58     past_compiler.'eval'( $P1 )
59 .end
62 .sub '__initconst' :init
63     $P0 = new 'EclectusBoolean'
64     $P0 = 1
65     set_root_global ['_eclectus'], '#t', $P0
66     $P0 = new 'EclectusBoolean'
67     set_root_global ['_eclectus'], '#f', $P0
68     $P0 = new 'EclectusEmptyList'
69     set_root_global ['_eclectus'], '()', $P0
70 .end
72 # Local Variables:
73 #   mode: pir
74 #   fill-column: 100
75 # End:
76 # vim: expandtab shiftwidth=4 ft=pir: