Sha256: 52678ec39355edba862a58185485c620d699e56a757e22aaa577431774baf0ba
Contents?: true
Size: 460 Bytes
Versions: 8
Compression:
Stored size: 460 Bytes
Contents
require File.join(File.dirname(__FILE__),"..","..","lib","babel_bridge") class TuringParser < BabelBridge::Parser ignore_whitespace binary_operators_rule :statement, :operand, [[:/, :*], [:+, :-]] do def evaluate left.evaluate.send operator, right.evaluate end end rule :operand, "(", :statement, ")" rule :operand, /[-]?[0-9]+/ do def evaluate to_s.to_i end end end BabelBridge::Shell.new(TuringParser.new).start
Version data entries
8 entries across 8 versions & 1 rubygems