PLTools / Lama

Teaching language LaMa for a compiler course
GNU General Public License v3.0
70 stars 37 forks source link

Internal compiler error #10

Closed eropsergeev closed 4 years ago

eropsergeev commented 4 years ago

Lamac's output: "Fatal error: exception File "X86.ml", line 663, characters 17-22: Pattern matching failed" Code: `import List;

fun compileExpr (expr) { case expr of Binop(op, e1, e2) -> compileExpr(e1) +++ compileExpr(e2) +++ singleton(Binop(op)) | Var(x) -> singleton(Ld(x)) | Const(x) -> singleton(Const(x)) esac; failure("Unsupported erpression\n") }

public fun compileSM (stmt) { case stmt of Seq(stmt1, stmt2) -> compileSM(stmt1) +++ compileSM(stmt2) | Read(x) -> {Read, St(x)} | Write(x) -> {Ld(x), Write} | Assn(x, e) -> compileExpr(e) +++ singleton(St(x)) esac; failure("Unsupported statement\n") }`

dboulytchev commented 4 years ago

Fixed in d06d9a250.