Class: Base::Compiler
- Inherits:
-
Object
- Object
- Base::Compiler
- Defined in:
- lib/base/compiler.rb
Constant Summary collapse
- Error =
Class.new(StandardError)
Instance Method Summary collapse
- #compile(data) ⇒ Object
-
#initialize(program) ⇒ Compiler
constructor
A new instance of Compiler.
Constructor Details
#initialize(program) ⇒ Compiler
Returns a new instance of Compiler.
5 6 7 8 9 10 |
# File 'lib/base/compiler.rb', line 5 def initialize(program) @program = program @parsing = [] @labels = {} @macros = {} end |
Instance Method Details
#compile(data) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/base/compiler.rb', line 12 def compile(data) lines = data.split("\n") parse(lines) @program.start_location = @labels["main"] || 0 true end |