Skip to content

Commit

Permalink
Added type variables to the menhir parser
Browse files Browse the repository at this point in the history
  • Loading branch information
green726 committed Nov 7, 2024
1 parent d444d6e commit ad1ffec
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7,037 deletions.
1 change: 1 addition & 0 deletions src/haz3lmenhir/AST.re
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type typ =
| TupleType(list(typ))
| ArrayType(typ)
| ArrowType(typ, typ)
| Var(string)
| InvalidTyp(string);

[@deriving (show({with_path: false}), sexp)]
Expand Down
1 change: 1 addition & 0 deletions src/haz3lmenhir/Conversion.re
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ and Typ: {
switch (p) {
| Internal => Unknown(Internal)
}
| Var(s) => Var(s)
| TupleType(ts) => Prod(List.map(of_menhir_ast, ts))
| ArrayType(t) => List(of_menhir_ast(t))
| ArrowType(t1, t2) => Arrow(of_menhir_ast(t1), of_menhir_ast(t2))
Expand Down
7,002 changes: 0 additions & 7,002 deletions src/haz3lmenhir/Parser.automaton

This file was deleted.

33 changes: 0 additions & 33 deletions src/haz3lmenhir/Parser.conflicts

This file was deleted.

1 change: 1 addition & 0 deletions src/haz3lmenhir/Parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ binExp:
| e1 = exp; b = binOp; e2 = exp { BinExp (e1, b, e2) }

typ:
| c = CONSTRUCTOR_IDENT { Var(c) }
| QUESTION; T_TYP; s = STRING { InvalidTyp(s) }
| INT_TYPE { IntType }
| FLOAT_TYPE { FloatType }
Expand Down
4 changes: 2 additions & 2 deletions test/Test_Menhir.re
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ let tests = [
"A ~ Int",
),
// TODO Fix for the tests below
skip_menhir_only_test(
menhir_only_test(
"Constructor with Type Variable",
Constructor("A", Var("T") |> Typ.fresh) |> Exp.fresh,
"A ~ T",
),
skip_parser_test(
parser_test(
"Type Variable",
Let(
Cast(
Expand Down

0 comments on commit ad1ffec

Please sign in to comment.