Jparsec is now ported to Ruby, with a way lighter syntax than Java. require 'rparsec' include RParsec class Calculator include Parsers include Functors def parser ops = OperatorTable.new. infixl(char(?+) >> Plus, 20). infixl(char(?-) >> Minus, 20). infixl(char(?*) >> Mul, 40). infixl(char(?/) >> Div, 40). prefix(char(?-) >> Neg, 60) expr = nil term = integer.map(&To_i) | char('(') >> lazy{expr} <<