Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Tfbsrxast;;
- open Tfbsrxpp;;
- (*
- * If you would like typechecking to be enabled by your interpreter by default,
- * then change the following value to true. Whether or not typechecking is
- * enabled by default, you can explicitly enable it or disable it using
- * command-line arguments.
- *)
- let typecheck_default_enabled = true;;
- (*
- * Replace this with your typechecker code. Your code should not throw the
- * following exception; if you need to raise an exception, create your own
- * exception type here.
- *)
- let rec baby_typecheck gamma e =
- match e with
- | Var ident -> TInt
- | Function(ident, fbtype, expr) -> TInt
- | LetRec(ident, ident1, fbtype, expr, fbtype2, expr2) -> TInt
- | Appl(expr1, expr2) -> TInt
- | Plus(expr1, expr2) -> TInt
- | Minus(expr1, expr2) -> TInt
- | Equal(expr1, expr2) -> TInt
- | And (expr1, expr2) -> TInt
- | Or (expr1, expr2) -> TInt
- | Not(expr) -> TInt
- | If(expr1, expr2, expr3) -> TInt
- | Int(tint) -> TInt
- | Bool(boo) -> TBool
- | Ref(expr) -> TInt
- | Get(expr) -> TInt
- | Record(reclist) -> TInt
- | Select(lab, expr) -> TInt
- | Raise(exnid, fbtype, expr) -> TInt
- | Try(expr, exnid, ident, fbtype, expr1) -> TInt
- | Cell(tint) -> TInt
- let typecheck e = baby_typecheck [] e;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement