rammar parts
  rule(:sum)        { 
    integer.as(:left) &gt;&gt; operator.as(:op) &gt;&gt; expression.as(:right) }
  rule(:arglist)    { expression &gt;&gt; (comma &gt;&gt; expression).repeat }
  rule(:funcall)    { 
    identifier.as(:funcall) &gt;&gt; lparen &gt;&gt; arglist.as(:arglist) &gt;&gt; rparen }
  
  rule(:expression) { funcall | sum | integer }
  root :expression
end

IntLit = Struct.new(:int) do
  def eval; int.to_i; end
end
Addition = Struct.new(:left, :right) do
  def eval; left.eval + rig