|
|
|
|
@@ -24,9 +24,7 @@ object ast {
|
|
|
|
|
case object PairLiter extends Expr6 with ParserBridge0[PairLiter.type]
|
|
|
|
|
case class Ident(v: String) extends Expr6 with LValue
|
|
|
|
|
object Ident extends ParserBridge1[String, Ident]
|
|
|
|
|
case class ArrayElem(name: Ident, indices: List[Expr])
|
|
|
|
|
extends Expr6
|
|
|
|
|
with LValue
|
|
|
|
|
case class ArrayElem(name: Ident, indices: List[Expr]) extends Expr6 with LValue
|
|
|
|
|
object ArrayElem extends ParserBridge2[Ident, List[Expr], ArrayElem]
|
|
|
|
|
case class Parens(expr: Expr) extends Expr6
|
|
|
|
|
object Parens extends ParserBridge1[Expr, Parens]
|
|
|
|
|
@@ -78,17 +76,13 @@ object ast {
|
|
|
|
|
case object BoolType extends BaseType with ParserBridge0[BoolType.type]
|
|
|
|
|
case object CharType extends BaseType with ParserBridge0[CharType.type]
|
|
|
|
|
case object StringType extends BaseType with ParserBridge0[StringType.type]
|
|
|
|
|
case class ArrayType(elemType: Type, dimensions: Int)
|
|
|
|
|
extends Type
|
|
|
|
|
with PairElemType
|
|
|
|
|
case class ArrayType(elemType: Type, dimensions: Int) extends Type with PairElemType
|
|
|
|
|
object ArrayType extends ParserBridge2[Type, Int, ArrayType]
|
|
|
|
|
case class PairType(fst: PairElemType, snd: PairElemType) extends Type
|
|
|
|
|
object PairType extends ParserBridge2[PairElemType, PairElemType, PairType]
|
|
|
|
|
|
|
|
|
|
sealed trait PairElemType
|
|
|
|
|
case object UntypedPairType
|
|
|
|
|
extends PairElemType
|
|
|
|
|
with ParserBridge0[UntypedPairType.type]
|
|
|
|
|
case object UntypedPairType extends PairElemType with ParserBridge0[UntypedPairType.type]
|
|
|
|
|
|
|
|
|
|
// waccadoodledo
|
|
|
|
|
case class Program(funcs: List[FuncDecl], main: List[Stmt])
|
|
|
|
|
@@ -101,8 +95,7 @@ object ast {
|
|
|
|
|
params: List[Param],
|
|
|
|
|
body: List[Stmt]
|
|
|
|
|
)
|
|
|
|
|
object FuncDecl
|
|
|
|
|
extends ParserBridge4[Type, Ident, List[Param], List[Stmt], FuncDecl]
|
|
|
|
|
object FuncDecl extends ParserBridge4[Type, Ident, List[Param], List[Stmt], FuncDecl]
|
|
|
|
|
|
|
|
|
|
case class Param(paramType: Type, name: Ident)
|
|
|
|
|
object Param extends ParserBridge2[Type, Ident, Param]
|
|
|
|
|
@@ -124,8 +117,7 @@ object ast {
|
|
|
|
|
object Exit extends ParserBridge1[Expr, Exit]
|
|
|
|
|
case class Print(expr: Expr, newline: Boolean) extends Stmt
|
|
|
|
|
object Print extends ParserBridge2[Expr, Boolean, Print]
|
|
|
|
|
case class If(cond: Expr, thenStmt: List[Stmt], elseStmt: List[Stmt])
|
|
|
|
|
extends Stmt
|
|
|
|
|
case class If(cond: Expr, thenStmt: List[Stmt], elseStmt: List[Stmt]) extends Stmt
|
|
|
|
|
object If extends ParserBridge3[Expr, List[Stmt], List[Stmt], If]
|
|
|
|
|
case class While(cond: Expr, body: List[Stmt]) extends Stmt
|
|
|
|
|
object While extends ParserBridge2[Expr, List[Stmt], While]
|
|
|
|
|
|