mewmew / uc

A compiler for the µC language.
57 stars 5 forks source link

parser: "error: invalid if statement else-body type; expected ast.Stmt, got *ast.ExprStmt" #35

Closed mewmew closed 8 years ago

mewmew commented 8 years ago
u@x1 ~/D/g/s/g/m/uc> uparse testdata/quiet/parser/p08.c
Parsing "testdata/quiet/parser/p08.c"

…

S44 ;(3,;) reduce:57(Expr15 : int_lit   << astx.NewBasicLit(X[0], token.IntLit) >>)
S61 ;(3,;) reduce:54(Expr14 : Expr15    <<  >>)
S60 ;(3,;) reduce:51(Expr13L : Expr14   <<  >>)
S58 ;(3,;) reduce:48(Expr12L : Expr13L  <<  >>)
S57 ;(3,;) reduce:43(Expr10L : Expr12L  <<  >>)
S56 ;(3,;) reduce:40(Expr9L : Expr10L   <<  >>)
S55 ;(3,;) reduce:38(Expr5L : Expr9L    <<  >>)
S166 ;(3,;) reduce:37(Expr2R : Expr2R "=" Expr5L    << astx.NewBinaryExpr(X[0], token.Assign, X[2]) >>)
S53 ;(3,;) reduce:35(Expr : Expr2R  <<  >>)
S162 ;(3,;) shift:234
pos: 150
typ: 14
lit: }

S234 }(14,}) reduce:25(Stmt : Expr ";"  << astx.NewExprStmt(X[0]) >>)
S283 }(14,}) reduce:33(ElsePart : "else" Stmt   << X[1], nil >>)
S281 }(14,}) reduce:29(Stmt : "if" Condition Stmt ElsePart  << astx.NewIfStmt(X[1], X[2], X[3]) >>)
2016/04/10 00:32:55 main.parseFile (uparse.go:71): error: Error in S90: }(14,}), Pos(offset=150, line=16, column=1)github.com/mewmew/uc/ast/astx.NewIfStmt (astx.go:152): error: invalid if statement else-body type; expected ast.Stmt, got *ast.ExprStmt