Skip to content

Commit 81968f1

Browse files
committed
Purge all mentions of type "Int" (in favour of "Integer")
Get selftest to build again.
1 parent 81a669a commit 81968f1

File tree

4 files changed

+36
-25
lines changed

4 files changed

+36
-25
lines changed

compiler/parsing/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
parsing-selftest.log

compiler/parsing/Holmakefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ INCLUDES = $(HOLDIR)/examples/formal-languages/context-free \
1010

1111
HOLHEAP = $(CAKEMLDIR)/misc/cakeml-heap
1212

13-
all: $(DEFAULT_TARGETS) selftest.exe
13+
all: $(DEFAULT_TARGETS) selftest.exe parsing-selftest.log
1414

1515
.PHONY: all
1616

1717
selftest.exe: selftest.uo
1818
$(HOLMOSMLC) -o $@ $<
1919

20-
EXTRA_CLEANS = selftest.exe
20+
EXTRA_CLEANS = selftest.exe parsing-selftest.log
21+
22+
parsing-selftest.log: selftest.exe
23+
$(tee ./$<,$@)

compiler/parsing/pureASTScript.sml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Datatype:
1717
End
1818

1919
Overload boolTy = “tyOp "Bool" []”;
20-
Overload intTy = “tyOp "Int" []”
20+
Overload intTy = “tyOp "Integer" []”
2121
Overload listTy = “λty. tyOp "[]" [ty]”
2222
Overload funTy = “λd r. tyOp "Fun" [d; r]”
2323

compiler/parsing/selftest.sml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ val _ = app lextest [
129129
];
130130

131131
val _ = app fptest [
132-
(“nTy”, "[Int]", “astType nTy”, “listTy intTy”),
132+
(“nTy”, "[Integer]", “astType nTy”, “listTy intTy”),
133133
(“nTy”, "a -> B", “astType nTy”, “funTy (tyVar "a") (tyOp "B" [])”),
134134
(“nTy”, "(Tree a, B)", “astType nTy”, “tyTup [tyOp "Tree" [tyVar "a"];
135135
tyOp "B" []]”),
136-
(“nTy”, "[Int -> ()]", “astType nTy”, “listTy (funTy intTy $ tyTup [])”),
136+
(“nTy”, "[Integer -> ()]", “astType nTy”, “listTy (funTy intTy $ tyTup [])”),
137137
(“nExp”, "f 2 x", “astExp nExp”, “‹f› ⬝ 𝕀 2 ⬝ ‹x›”),
138138
(“nExp”, "\\x y -> y x", “astExp nExp”,
139139
“expAbs (patVar "x") (expAbs (patVar "y") (‹y› ⬝ ‹x›))”),
@@ -202,7 +202,7 @@ val _ = app fptest [
202202
“App () (𝕍u «f») [𝕍u «y»; 𝕁 3] >>=
203203
Lam () [«x»] (App () (𝕍u «foo») [𝕍u «x»])”),
204204
(“nExp”, "do let y = 10\n\
205-
\ f :: Int -> Int\n\
205+
\ f :: Integer -> Integer\n\
206206
\ f z = z + 1\n\
207207
\ x <- g (f y) 3\n\
208208
\ foo x",
@@ -237,18 +237,18 @@ val _ = app fptest [
237237
(“nExp”, "case e of h : t -> 3",
238238
“CEXP”,
239239
“Case () (𝕍 «e») «» [(«::», [«h»; «t»], 𝕁 3)] NONE”),
240-
(“nDecl”, "f :: a -> Int", “astDecl”,
241-
“declTysig "f" (funTy (tyVar "a") (tyOp "Int" []))”),
240+
(“nDecl”, "f :: a -> Integer", “astDecl”,
241+
“declTysig "f" (funTy (tyVar "a") intTy)”),
242242
(“nDecl”, "f x y = x + y", “astDecl”,
243243
“declFunbind "f" [patVar "x"; patVar "y"] (‹+› ⬝ ‹x› ⬝ ‹y›)”),
244244
(“nDecl”, "h:t = f e", “astDecl”,
245245
“declPatbind (patApp "::" [patVar "h"; patVar "t"]) (‹f› ⬝ ‹e›)”),
246-
(“nDecl”, "data Foo a = C a Int | D [Int]", “astDecl”,
247-
“declData "Foo" ["a"] [("C", [tyVar "a"; tyOp "Int" []]);
248-
("D", [tyOp "[]" [tyOp "Int"[]]])]”),
249-
(“nDecls”, "data Bar = C | D Int Bar\nf:: Bar -> Int", “astDecls”,
250-
“[declData "Bar" [] [("C", []); ("D", [tyOp "Int" []; tyOp "Bar" []])];
251-
declTysig "f" (funTy (tyOp "Bar" []) (tyOp "Int" []))]”),
246+
(“nDecl”, "data Foo a = C a Integer | D [Integer]", “astDecl”,
247+
“declData "Foo" ["a"] [("C", [tyVar "a"; intTy]);
248+
("D", [tyOp "[]" [intTy]])]”),
249+
(“nDecls”, "data Bar = C | D Integer Bar\nf:: Bar -> Integer", “astDecls”,
250+
“[declData "Bar" [] [("C", []); ("D", [intTy; tyOp "Bar" []])];
251+
declTysig "f" (funTy (tyOp "Bar" []) intTy)]”),
252252
(“nDecls”, "data Bar = C | D Integer Bar\nf:: Bar -> Integer", “CDECLS”,
253253
“(Letrec () [] CMAIN,
254254
[(1n, [(«[]»,[]); («::»,[TypeVar 0; TypeCons 0 [TypeVar 0]])]);
@@ -304,13 +304,20 @@ val _ = app convtest [
304304
[(1n,[(«[]»,[]); («::»,[TypeVar 0; TypeCons 0 [TypeVar 0]])])])”)
305305
]
306306

307+
308+
val handle_inferResult_def = Define‘
309+
handle_inferResult ires =
310+
case ires of
311+
OK x => SOME x
312+
| Err _ => NONE
313+
307314
val upto_demands_def = Define‘
308-
upto_demands s =
315+
upto_demands (opts:compiler_opts) s =
309316
do
310317
(e1,ns) <- string_to_cexp s;
311-
e2 <<- transform_cexp e1;
312-
infer_types ns e2;
313-
return e2
318+
e2 <<- transform_cexp opts e1;
319+
handle_inferResult $ infer_types ns e2 ;
320+
return e2;
314321
od
315322
’;
316323

@@ -451,13 +458,13 @@ fun string_check s c f =
451458
end;
452459

453460
val with_demands_def = Define‘
454-
with_demands s =
461+
with_demands opts s =
455462
do
456463
(e1,ns) <- string_to_cexp s;
457-
e2 <<- transform_cexp e1;
458-
infer_types ns e2;
459-
e3 <<- demands_analysis e2;
460-
infer_types ns e3;
464+
e2 <<- transform_cexp opts e1;
465+
handle_inferResult $ infer_types ns e2;
466+
e3 <<- demands_analysis opts e2;
467+
handle_inferResult $ infer_types ns e3;
461468
return e3
462469
od
463470
’;
@@ -483,10 +490,10 @@ val wd = wd0 THENC
483490
PURE_REWRITE_CONV[optionTheory.OPTION_IGNORE_BIND_thm]
484491

485492
val notypes_def = Define‘
486-
notypes s =
493+
notypes opts s =
487494
do
488495
(e1,ns) <- string_to_cexp s;
489-
e2 <<- transform_cexp e1;
496+
e2 <<- transform_cexp opts e1;
490497
return e2
491498
od
492499
’;

0 commit comments

Comments
 (0)