Class: Interscript::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/interscript/compiler.rb

Overview

An Interscript compiler interface

Direct Known Subclasses

Javascript, Ruby, Interpreter

Defined Under Namespace

Classes: Javascript, Ruby

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/interscript/compiler.rb', line 3

def code
  @code
end

Class Method Details

.call(map, **kwargs) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/interscript/compiler.rb', line 5

def self.call(map, **kwargs)
  if String === map
    map = Interscript::DSL.parse(map)
  end
  compiler = new
  compiler.compile(map, **kwargs)
  compiler
end

Instance Method Details

#callObject

Execute a map

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/interscript/compiler.rb', line 19

def call
  raise NotImplementedError, "Call class on #{self.class} is not implemented"
end

#compile(map) ⇒ Object

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/interscript/compiler.rb', line 14

def compile(map)
  raise NotImplementedError, "Compile method on #{self.class} is not implemented"
end