3 js -- A compiler for js ECMAScript-262
7 $ ./parrot languages/emcascript/js.pir script.js
11 js is a compiler for ECMAScript-262 (3rd edition) running on Parrot.
16 #.include 'src/gen_builtins.pir'
18 ## Create a 'List' class; stolen from Rakudo.
19 ## At some point, this should be refactored/reused.
23 .sub '__onload' :load :init
24 $P0 = subclass 'ResizablePMCArray', 'List'
27 ## Methods for the List class
36 .sub 'unshift' :method
50 .namespace ['JS::Compiler']
54 .sub 'onload' :load :init :anon
55 load_bytecode 'PCT.pbc'
56 load_bytecode 'Protoobject.pbc'
58 $P0 = get_hll_global 'Protomaker'
59 $P1 = get_class ['PCT::HLLCompiler']
60 $P0.'new_subclass'($P1, 'JS::Compiler')
62 ## Create a list called '@?BLOCK' and store it, so it can
63 ## be used in the parse actions.
66 set_hll_global ['JS';'Grammar';'Actions'], '@?BLOCK', $P0
70 .sub 'init' :vtable :method
72 self.'parsegrammar'('JS::Grammar')
73 self.'parseactions'('JS::Grammar::Actions')
80 $P1 = $P0.'command_line'(args)
84 .include 'src/gen_grammar.pir'
85 .include 'src/gen_actions.pir'
90 .include 'src/builtin/builtins.pir'
97 # vim: expandtab shiftwidth=4 ft=pir: