Sha256: 65c7a1ea11cb99a0a8ed4ee2d46c5a6e6c9c6a1faab9f350d5f6dd9053c4795a
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
class Fancy Compiler Stages { class Stage : Rubinius Compiler Stage { define_method('initialize) |compiler last| { sup = Rubinius Compiler Stage instance_method('initialize) sup bind(self) call(compiler, last) initialize: compiler last: last } def self stage: name next: next (nil) { stage(name) next_stage(next) } run = { self run; run_next() } define_method('run, &run) } class FancyGenerator : Stage { stage: 'fancy_bytecode next: Rubinius Compiler Encoder read_write_slot: 'variable_scope def initialize: compiler last: last { @variable_scope = nil compiler generator: self } def run { @output = Rubinius Generator new() @input variable_scope=(@variable_scope) @input bytecode(@output) @output close() } } class FancyCodeParser : Stage { stage: 'fancy_code next: FancyGenerator read_write_slots: ['root, 'print] def initialize: compiler last: last { compiler parser: self } def input: @code file: @filename line: @line (1); def run { ast = Fancy Parser parse_code: @code file: @filename line: @line # if: @print then: { ast inspect println } @output = @root new(ast) @output file=(@filename) } } class FancyFileParser : Stage { stage: 'fancy_file next: FancyGenerator read_write_slots: ['root, 'print] def initialize: compiler last: last { compiler parser: self } def input: @filename line: @line (1); def run { ast = Fancy Parser parse_file: @filename line: @line # if: @print then: { ast inspect println } @output = @root new(ast) @output file=(@filename) } } }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fancy-0.10.0 | lib/compiler/stages.fy |
fancy-0.9.0 | lib/compiler/stages.fy |
fancy-0.8.0 | lib/compiler/stages.fy |