Module: Predicator
- Defined in:
- lib/predicator.rb,
lib/predicator/ast.rb,
lib/predicator/parser.rb,
lib/predicator/context.rb,
lib/predicator/version.rb,
lib/predicator/evaluator.rb,
lib/predicator/visitors/dot.rb,
lib/predicator/visitors/each.rb,
lib/predicator/visitors/string.rb,
lib/predicator/visitors/visitor.rb,
lib/predicator/visitors/instructions.rb
Defined Under Namespace
Modules: AST, Visitors
Classes: Context, Evaluator, Lexer, Parser
Constant Summary
collapse
- VERSION =
"1.2.1"
Class Method Summary
collapse
Class Method Details
.compile(source) ⇒ Object
10
11
12
13
|
# File 'lib/predicator.rb', line 10
def self.compile source
ast = parse source
ast.to_instructions
end
|
.evaluate(source, context = {}) ⇒ Object
15
16
17
18
|
# File 'lib/predicator.rb', line 15
def self.evaluate source, context={}
instructions = compile source
evaluate_instructions instructions, context
end
|
.evaluate_instructions(instructions, context = {}) ⇒ Object
20
21
22
23
|
# File 'lib/predicator.rb', line 20
def self.evaluate_instructions instructions, context={}
evaluator = Evaluator.new instructions, context
evaluator.result
end
|