Class: Tracekit::Evaluator::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/tracekit/evaluator.rb

Overview

Recursive-descent parser and evaluator. Operator precedence (lowest to highest):

|| -> && -> == != -> < > <= >= -> + - -> * / -> ! (unary) -> primary

Instance Method Summary collapse

Constructor Details

#initialize(tokens, env) ⇒ Parser

Returns a new instance of Parser.



327
328
329
330
331
# File 'lib/tracekit/evaluator.rb', line 327

def initialize(tokens, env)
  @tokens = tokens
  @env = env
  @pos = 0
end

Instance Method Details

#parse_expressionObject



333
334
335
# File 'lib/tracekit/evaluator.rb', line 333

def parse_expression
  parse_or
end