feat: type-checker returns micro wacc
This commit is contained in:
@@ -19,7 +19,7 @@ object microWacc {
|
||||
extends Expr(identTy)
|
||||
with CallTarget(identTy)
|
||||
with LValue
|
||||
case class ArrayElem(name: Ident, indices: NonEmptyList[Expr])(ty: SemType)
|
||||
case class ArrayElem(value: LValue, indices: NonEmptyList[Expr])(ty: SemType)
|
||||
extends Expr(ty)
|
||||
with LValue
|
||||
|
||||
@@ -48,6 +48,23 @@ object microWacc {
|
||||
case And
|
||||
case Or
|
||||
}
|
||||
object BinaryOperator {
|
||||
def fromAst(op: ast.BinaryOp): BinaryOperator = op match {
|
||||
case _: ast.Add => Add
|
||||
case _: ast.Sub => Sub
|
||||
case _: ast.Mul => Mul
|
||||
case _: ast.Div => Div
|
||||
case _: ast.Mod => Mod
|
||||
case _: ast.Greater => Greater
|
||||
case _: ast.GreaterEq => GreaterEq
|
||||
case _: ast.Less => Less
|
||||
case _: ast.LessEq => LessEq
|
||||
case _: ast.Eq => Eq
|
||||
case _: ast.Neq => Neq
|
||||
case _: ast.And => And
|
||||
case _: ast.Or => Or
|
||||
}
|
||||
}
|
||||
|
||||
// Statements
|
||||
sealed trait Stmt
|
||||
|
||||
Reference in New Issue
Block a user