-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd3fd9b
commit ef02f5d
Showing
28 changed files
with
307 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
(* unit-test-basic.timl *) | ||
(* (* unit-test-basic.timl *) *) | ||
|
||
(* basic.timl *) | ||
(* list.timl *) | ||
(* (* basic.timl *) *) | ||
(* (* list.timl *) *) | ||
|
||
stdlib.pkg | ||
(* stdlib.pkg *) | ||
|
||
(* unit-test-bool.timl *) | ||
(* unit-test-array.timl *) | ||
(* unit-test-list.timl *) | ||
(* (* unit-test-bool.timl *) *) | ||
(* (* unit-test-array.timl *) *) | ||
(* (* unit-test-list.timl *) *) | ||
|
||
(* perversive-list.timl *) | ||
(* trivial.timl *) | ||
(* bigO-evolve.timl *) | ||
(* fold-evolve.timl *) | ||
(* single-var.timl *) | ||
(* bug.timl *) | ||
(* pldi-2017-review-example.timl *) | ||
(* braun-tree-sortedness.timl *) | ||
(* rbt-sortedness.timl *) | ||
(* (* perversive-list.timl *) *) | ||
(* (* trivial.timl *) *) | ||
(* (* bigO-evolve.timl *) *) | ||
(* (* fold-evolve.timl *) *) | ||
(* (* single-var.timl *) *) | ||
(* (* bug.timl *) *) | ||
(* (* pldi-2017-review-example.timl *) *) | ||
(* (* braun-tree-sortedness.timl *) *) | ||
(* (* rbt-sortedness.timl *) *) | ||
|
||
(* ragged-matrix.timl *) | ||
(* tree.timl *) | ||
(* msort.timl *) | ||
(* insertion-sort.timl *) | ||
(* braun-tree.timl *) | ||
(* rbt.timl *) | ||
(* functional-queue.timl *) | ||
(* array-bsearch.timl *) | ||
(* array-heap.timl *) | ||
(* array-msort.timl *) | ||
(* array-msort-inplace.timl *) | ||
(* array-kmed.timl *) | ||
(* dlist.timl *) | ||
(* qsort.timl *) | ||
(* dijkstra.timl *) | ||
(* (* ragged-matrix.timl *) *) | ||
(* (* tree.timl *) *) | ||
(* (* msort.timl *) *) | ||
(* (* insertion-sort.timl *) *) | ||
(* (* braun-tree.timl *) *) | ||
(* (* rbt.timl *) *) | ||
(* (* functional-queue.timl *) *) | ||
(* (* array-bsearch.timl *) *) | ||
(* (* array-heap.timl *) *) | ||
(* (* array-msort.timl *) *) | ||
(* (* array-msort-inplace.timl *) *) | ||
(* (* array-kmed.timl *) *) | ||
(* (* dlist.timl *) *) | ||
(* (* qsort.timl *) *) | ||
(* (* dijkstra.timl *) *) | ||
|
||
(* dynamic-table.timl *) | ||
(* dynamic-table-test.timl *) | ||
(* (* dynamic-table.timl *) *) | ||
(* (* dynamic-table-test.timl *) *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
structure Pervasive = struct | ||
|
||
datatype some_nat = SomeNat {n : Nat} of nat {n} | ||
(* assuming 256-bit integers *) | ||
datatype some_nat = SomeNat {n : Nat | n < 2 ** 256} of nat {n} | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(* Utilities for MicroTiMLEx specialized to Expr *) | ||
|
||
structure MicroTiMLExUtilTiML = struct | ||
|
||
open Expr | ||
open MicroTiMLExLongId | ||
open MicroTiMLExUtil | ||
|
||
infixr 0 $ | ||
|
||
infix 9 %@ | ||
infix 8 %^ | ||
infix 7 %* | ||
infix 6 %+ | ||
infix 4 %<= | ||
infix 4 %< | ||
infix 4 %>= | ||
infix 4 %> | ||
infix 4 %= | ||
infixr 3 /\ | ||
infixr 2 \/ | ||
infixr 1 --> | ||
infix 1 <-> | ||
|
||
infix 8 %** | ||
fun a %** b = ExpI (a, b) | ||
|
||
val unTAbsT = unBindAnnoName | ||
|
||
fun whnf ctx t = | ||
case t of | ||
TAppT (t1, t2) => | ||
let | ||
val t1 = whnf ctx t1 | ||
in | ||
case t1 of | ||
TAbsT data => | ||
let | ||
val (_, (_, t1)) = unTAbsT data | ||
in | ||
whnf ctx $ subst0_t_t t2 t1 | ||
end | ||
| _ => TAppT (t1, t2) | ||
end | ||
| TAppI (t, i) => | ||
let | ||
val t = whnf ctx t | ||
in | ||
case t of | ||
TAbsI data => | ||
let | ||
val (_, (_, t)) = unTAbsT data | ||
in | ||
whnf ctx $ subst0_i_t i t | ||
end | ||
| _ => TAppI (t, i) | ||
end | ||
| TVar x => TVar x (* todo: look up type aliasing in ctx *) | ||
| _ => t | ||
|
||
fun MakeSubset (name, s, p) = Subset ((s, dummy), Bind.Bind ((name, dummy), p), dummy) | ||
local | ||
fun IV n = VarI (ID (n, dummy), []) | ||
in | ||
fun TSomeNat_packed () = TExistsI $ IBindAnno ((("n", dummy), MakeSubset ("n", BSNat, IV 0 %< ConstIN (2, dummy) %** ("256", dummy))), TNat $ IV 0) | ||
fun TSomeNat () = TRec $ TBindAnno ((("some_nat", dummy), KType), TSomeNat_packed ()) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.