2 def initialize parser, code_generator, output
4 @generator = code_generator
10 words = @parser.parse_line
15 while words[0] =~ /^\w+:$/
16 label = words[0][0..-2]
17 @generator.label label
23 action, args = words[0], words[1..-1]
33 @generator.ifnonzero words[2..-1]
35 raise "Invalid action: #{action} #{words[1]}"
41 @generator.end_function
45 raise "Unknown action: #{action} #{words[1]}"
48 @generator.export *args
50 @generator.function args
54 @generator.ifnonzero *args
56 @generator.import *args
64 @generator.section *args
68 @generator.string *args
70 @generator.tail_call *args
72 raise "Unknown action: #{words[0]}"
76 @generator.write @output