Module: Fop

Defined in:
lib/fop/cli.rb,
lib/fop_lang.rb,
lib/fop/nodes.rb,
lib/fop/parser.rb,
lib/fop/tokens.rb,
lib/fop/program.rb,
lib/fop/version.rb,
lib/fop/compiler.rb,
lib/fop/tokenizer.rb

Defined Under Namespace

Modules: CLI, Compiler, Nodes, Tokens Classes: Parser, Program, Tokenizer

Constant Summary collapse

VERSION =
"0.8.0"

Class Method Summary collapse

Class Method Details

.compile(src) ⇒ Object



17
18
19
20
21
# File 'lib/fop_lang.rb', line 17

def self.compile(src)
  instructions, errors = ::Fop::Compiler.compile(src)
  return nil, errors if errors
  return Program.new(instructions), nil
end

.compile!(src) ⇒ Object



10
11
12
13
14
15
# File 'lib/fop_lang.rb', line 10

def self.compile!(src)
  prog, errors = compile(src)
  # TODO better exception
  raise "Fop errors: " + errors.map(&:message).join(",") if errors
  prog
end