tok_val a tok_val b tok_val c -- 1+2 => Other -- 1+2*3 => Other -- 1*2+3 => Other -- (1+2)*3 => Other -- a+b+c+d => Other -- a*b*3*4 => Other -- 1 => Const 1 -- a => Var a -- ( => Parse error: Unexpected token -- ) => Parse error: Expected ( -- (a+b => Parse error: Expected ) -- => Parse error: Unexpected token -- $$ => Parse error: Unexpected token c.i -1 v.name '' b.op '' (expr.Binary op:"+" left:(expr.Const i:1) right:(expr.Const i:2)) (expr.Binary op: "+" left: (expr.Const i:1) right: (expr.Binary op:"*" left:(expr.Const i:2) right:(expr.Const i:3)) ) (expr.Binary op: "+" left: (expr.Binary op:"*" left:(expr.Const i:1) right:(expr.Const i:2)) right: (expr.Const i:3) ) (expr.Binary op: "*" left: (expr.Binary op:"+" left:(expr.Const i:1) right:(expr.Const i:2)) right: (expr.Const i:3) ) (expr.Binary op: "+" left: (expr.Binary op: "+" left: (expr.Binary op:"+" left:(expr.Var name:a) right:(expr.Var name:b)) right: (expr.Var name:c) ) right: (expr.Var name:d) ) (expr.Binary op: "*" left: (expr.Binary op: "*" left: (expr.Binary op:"*" left:(expr.Var name:a) right:(expr.Var name:b)) right: (expr.Const i:3) ) right: (expr.Const i:4) ) (expr.Const i:1) (expr.Var name:a) (expr.Binary op:"+" left:(expr.Const i:-1) right:(expr.Var name:""))