Slide 49
Slide 49 text
/* left = &ast.PrefixExpression{Token: /* - MINUS*/ Operator: /* - */,Rignt: &ast.IntegerLiteral{Token:3} } */
func (p *Parser) parseInfixExpression(left ast.Expression) ast.Expression {
expression := &ast.InfixExpression{
Token: p.curToken, PLUS
Operator: p.curToken.Literal, PLUS
Left: left,
}
precedence := p.curPrecedence() / * PLUS*/
p.nextToken()
expression.Right = p.parseExpression(precedence)
Right
&ast.InfixExpression{Token: PLUS,Operator: +l
,Left:/*&ast.IntegerLiteral{Token: 10} */ ,
Right: /*&ast.IntegerLiteral{Token: 2} */ }}
return expression