Skip to content

Commit

Permalink
Introduce parseUnaryExpr()
Browse files Browse the repository at this point in the history
  • Loading branch information
DQNEO committed Aug 29, 2019
1 parent ec66c37 commit fe21f59
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type Expr struct {
intval int // for intliteral
}

func parse() *Expr {
func parseUnaryExpr() *Expr {
token := getToken()

intval, _ := strconv.Atoi(token.value)
Expand All @@ -110,6 +110,11 @@ func parse() *Expr {
return expr
}

func parse() *Expr {
expr := parseUnaryExpr()
return expr
}

func generateExpr(expr *Expr) {
fmt.Printf(" movq $%d, %%rax\n", expr.intval)
}
Expand Down

0 comments on commit fe21f59

Please sign in to comment.