├── Makefile ├── README.md ├── build └── rkttt ├── compiled ├── eval_rkt.dep ├── eval_rkt.zo ├── expr_rkt.dep ├── expr_rkt.zo ├── lexing_rkt.dep ├── lexing_rkt.zo ├── normal_rkt.dep ├── normal_rkt.zo ├── parsing_rkt.dep ├── parsing_rkt.zo ├── readback_rkt.dep ├── readback_rkt.zo ├── rkttt_rkt.dep ├── rkttt_rkt.zo ├── tc_rkt.dep ├── tc_rkt.zo ├── val_rkt.dep └── val_rkt.zo ├── debug ├── debug.lalr └── debug.y ├── doc ├── manual-fonts.css ├── manual-racket.css ├── manual-racket.js ├── manual-style.css ├── notes.html ├── notes.scrbl ├── racket.css ├── scribble-common.js └── scribble.css ├── eval.rkt ├── examples ├── function.rkttt ├── girard.rkttt ├── io.rkttt ├── nat.rkttt └── test.rkttt ├── expr.rkt ├── lexing.rkt ├── nanopass-experiment ├── expr.rkt └── nexpr.rkt ├── normal.rkt ├── parsing.rkt ├── readback.rkt ├── rkttt.rkt ├── tc.rkt ├── testout ├── translate.rkt └── val.rkt /Makefile: -------------------------------------------------------------------------------- 1 | build: rkttt.rkt ./build/rkttt 2 | time raco exe -o ./build/rkttt rkttt.rkt 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is this ?????? 2 | 3 | A new and awful implementation of Thierry Coquand et. al's Mini-TT language :) 4 | 5 | https://www.cambridge.org/core/books/abs/from-semantics-to-computer-science/simple-typetheoretic-language-minitt/21451A12E2E24A1F51C82421B066824A 6 | 7 | also was helped a lot by this implementation as a reference 8 | 9 | https://github.com/owo-lang/minitt-rs 10 | 11 | The main algorithm is in `tc.rkt`, and there is some work that I'm doing to write some 12 | documentation of what *exactly* is going on; but this was really fun to work on and 13 | I have become, if only a little, slightly more confident in what the hell is going on with 14 | type checking :) 15 | -------------------------------------------------------------------------------- /build/rkttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/build/rkttt -------------------------------------------------------------------------------- /compiled/eval_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("275034425c69ee14369a3ec748f2877591237f66" . "fdef3cf7b8d183cb6930619009a19b6802b81032") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/val.rkt" (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"lang" #"reader.rkt") (collects #"typed" #"racket.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"racket" #"match" #"gen-match.rkt") (indirect collects #"racket" #"match" #"parse.rkt") (indirect collects #"syntax" #"define.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-subst.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt") (indirect collects #"typed-racket" #"types" #"prop-ops.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/eval_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/eval_rkt.zo -------------------------------------------------------------------------------- /compiled/expr_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("3c2e33daa79f852751057239db17145d010879d4" . "d3d77d290175c6e3d6d904b284cb623a5159a142") (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"shallow" #"lang" #"reader.rkt") (collects #"typed" #"racket" #"shallow.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"private" #"shallow-rewrite.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/expr_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/expr_rkt.zo -------------------------------------------------------------------------------- /compiled/lexing_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("07bdb5aaff0c641b092d0be886e58d9cc45f5c07" . "90d3c64daade523d8592fba3b39ce672402556e1") (collects #"parser-tools" #"lex-sre.rkt") (collects #"parser-tools" #"lex.rkt") (collects #"parser-tools" #"yacc.rkt") (collects #"racket" #"main.rkt") (collects #"racket" #"runtime-config.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/lexing_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/lexing_rkt.zo -------------------------------------------------------------------------------- /compiled/normal_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("a2c3408fc232119c3e39592b7e1429a4688bde29" . "37641223792d0887ba0a8efd398cdb5413c8e14b") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"lang" #"reader.rkt") (collects #"typed" #"racket.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/normal_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/normal_rkt.zo -------------------------------------------------------------------------------- /compiled/parsing_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("2a9c7ca481f4109a1ef817c0038b6a28946ffde4" . "c9c3c72cd48ecc1149462d399fca0045685dc113") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/lexing.rkt" (collects #"parser-tools" #"yacc.rkt") (collects #"racket" #"main.rkt") (collects #"racket" #"runtime-config.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/parsing_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/parsing_rkt.zo -------------------------------------------------------------------------------- /compiled/readback_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("7a46a5c4e21b086665185064c5854466bfa8e808" . "a0505096188eb86e8a030609af47f22982c21416") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/eval.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/normal.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/val.rkt" (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"lang" #"reader.rkt") (collects #"typed" #"racket.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"racket" #"match" #"gen-match.rkt") (indirect collects #"racket" #"match" #"parse.rkt") (indirect collects #"syntax" #"define.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/readback_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/readback_rkt.zo -------------------------------------------------------------------------------- /compiled/rkttt_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("5b8c12340feed8205ea55d2a407e47b931d47bec" . "16d273b47a0ac6939458195d9a7b0c4cb1965994") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/parsing.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/tc.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/val.rkt" (collects #"racket" #"main.rkt") (collects #"racket" #"runtime-config.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/rkttt_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/rkttt_rkt.zo -------------------------------------------------------------------------------- /compiled/tc_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("2221c8eb3fb83ac859b14aa52ee296dac2fb3ef6" . "fb4086be9b5257f30960568c8db1a5072cd88ba0") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/eval.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/readback.rkt" #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/val.rkt" (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"shallow" #"lang" #"reader.rkt") (collects #"typed" #"racket" #"shallow.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"racket" #"match" #"gen-match.rkt") (indirect collects #"racket" #"match" #"parse.rkt") (indirect collects #"syntax" #"define.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"infer" #"infer.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"private" #"shallow-rewrite.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-subst.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt") (indirect collects #"typed-racket" #"types" #"overlap.rkt") (indirect collects #"typed-racket" #"types" #"printer.rkt") (indirect collects #"typed-racket" #"types" #"prop-ops.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/tc_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/tc_rkt.zo -------------------------------------------------------------------------------- /compiled/val_rkt.dep: -------------------------------------------------------------------------------- 1 | ("8.9" tarm64osx ("337b5f392da88c849e888fe0c7e11db4786d4048" . "37641223792d0887ba0a8efd398cdb5413c8e14b") #"/Users/connorhanley/Code/compvert/mini-tt/rkttt/expr.rkt" (collects #"racket" #"base.rkt") (collects #"racket" #"contract" #"parametric.rkt") (collects #"racket" #"private" #"sort.rkt") (collects #"racket" #"runtime-config.rkt") (collects #"racket" #"runtime-path.rkt") (collects #"racket" #"sequence.rkt") (collects #"typed" #"racket" #"lang" #"reader.rkt") (collects #"typed" #"racket.rkt") (collects #"typed-racket" #"env" #"global-env.rkt") (collects #"typed-racket" #"env" #"struct-name-env.rkt") (collects #"typed-racket" #"env" #"type-alias-env.rkt") (collects #"typed-racket" #"env" #"type-name-env.rkt") (collects #"typed-racket" #"private" #"type-contract.rkt") (collects #"typed-racket" #"types" #"abbrev.rkt") (collects #"typed-racket" #"types" #"numeric-tower.rkt") (collects #"typed-racket" #"types" #"struct-table.rkt") (collects #"typed-racket" #"utils" #"any-wrap.rkt") (collects #"typed-racket" #"utils" #"eq-contract.rkt") (collects #"typed-racket" #"utils" #"evt-contract.rkt") (collects #"typed-racket" #"utils" #"hash-contract.rkt") (collects #"typed-racket" #"utils" #"opaque-object.rkt") (collects #"typed-racket" #"utils" #"prefab-c.rkt") (collects #"typed-racket" #"utils" #"promise-not-name-contract.rkt") (collects #"typed-racket" #"utils" #"redirect-contract.rkt") (collects #"typed-racket" #"utils" #"sealing-contract.rkt") (collects #"typed-racket" #"utils" #"shallow-contract.rkt") (collects #"typed-racket" #"utils" #"simple-result-arrow.rkt") (collects #"typed-racket" #"utils" #"struct-type-c.rkt") (collects #"typed-racket" #"utils" #"utils.rkt") (collects #"typed-racket" #"utils" #"vector-contract.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-indexing.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env-numeric.rkt") (indirect collects #"typed-racket" #"base-env" #"base-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-special-env.rkt") (indirect collects #"typed-racket" #"base-env" #"base-structs.rkt") (indirect collects #"typed-racket" #"core.rkt") (indirect collects #"typed-racket" #"optimizer" #"optimizer.rkt") (indirect collects #"typed-racket" #"rep" #"type-rep.rkt") (indirect collects #"typed-racket" #"typecheck" #"tc-toplevel.rkt")) 2 | -------------------------------------------------------------------------------- /compiled/val_rkt.zo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/compiled/val_rkt.zo -------------------------------------------------------------------------------- /debug/debug.lalr: -------------------------------------------------------------------------------- 1 | 0 g982 = (g983) 2 | 1 g983 = (decls EOF) 3 | 2 decls = () 4 | 3 decls = (decl) 5 | 4 decls = (decl decls) 6 | 5 decl = (LPAREN LET tvar expr RPAREN) 7 | 6 decl = (LPAREN LETREC tvar expr RPAREN) 8 | 7 tvar = (LPAREN COLON patt expr RPAREN) 9 | 8 patt = (WILD) 10 | 9 patt = (IDENT) 11 | 10 patt = (LPAREN COMMA patt patt RPAREN) 12 | 11 expr = (IDENT) 13 | 12 expr = (LABEL) 14 | 13 expr = (LPAREN LABEL expr RPAREN) 15 | 14 expr = (LPAREN expr expr RPAREN) 16 | 15 expr = (LPAREN CONS expr expr RPAREN) 17 | 16 expr = (LPAREN LAMBDA patt expr RPAREN) 18 | 17 expr = (LPAREN PI tvar expr RPAREN) 19 | 18 expr = (LPAREN SIGMA tvar expr RPAREN) 20 | 19 expr = (LPAREN ARROW expr expr RPAREN) 21 | 20 expr = (LPAREN STAR expr expr RPAREN) 22 | 21 expr = (SET) 23 | 22 expr = (UNIT) 24 | 23 expr = (ONE) 25 | 24 expr = (LPAREN LABEL expr RPAREN) 26 | 25 expr = (LPAREN SUM LBRACK branches RBRACK RPAREN) 27 | 26 expr = (LPAREN FUN LBRACK branches RBRACK RPAREN) 28 | 27 expr = (LPAREN CAR expr RPAREN) 29 | 28 expr = (LPAREN CDR expr RPAREN) 30 | 29 expr = (VOID) 31 | 30 branch = (LABEL) 32 | 31 branch = (LPAREN LABEL expr RPAREN) 33 | 32 branch = (LPAREN FATARROW LABEL expr RPAREN) 34 | 33 branch = (LPAREN FATARROW LPAREN LABEL patt RPAREN expr RPAREN) 35 | 34 branches = () 36 | 35 branches = (branch) 37 | 36 branches = (branch branches) 38 | State 0 39 | g982 -> . g983 40 | 41 | g983 goto 1 42 | decls goto 2 43 | LPAREN shift 4 44 | EOF reduce 2 45 | decl goto 3 46 | 47 | State 1 48 | g982 -> g983 . 49 | 50 | 51 | State 2 52 | g983 -> decls . EOF 53 | 54 | EOF accept 55 | 56 | State 3 57 | decls -> decl . 58 | decls -> decl . decls 59 | 60 | decls goto 6 61 | LPAREN shift 4 62 | begin conflict: 63 | EOF reduce 2 64 | EOF reduce 3 65 | end conflict 66 | decl goto 3 67 | 68 | State 4 69 | decl -> LPAREN . LET tvar expr RPAREN 70 | decl -> LPAREN . LETREC tvar expr RPAREN 71 | 72 | LET shift 7 73 | LETREC shift 8 74 | 75 | State 5 76 | g983 -> decls EOF . 77 | 78 | 79 | State 6 80 | decls -> decl decls . 81 | 82 | EOF reduce 4 83 | 84 | State 7 85 | decl -> LPAREN LET . tvar expr RPAREN 86 | 87 | tvar goto 9 88 | LPAREN shift 10 89 | 90 | State 8 91 | decl -> LPAREN LETREC . tvar expr RPAREN 92 | 93 | tvar goto 11 94 | LPAREN shift 10 95 | 96 | State 9 97 | decl -> LPAREN LET tvar . expr RPAREN 98 | 99 | LABEL shift 19 100 | UNIT shift 16 101 | SET shift 14 102 | expr goto 12 103 | ONE shift 15 104 | VOID shift 17 105 | LPAREN shift 13 106 | IDENT shift 18 107 | 108 | State 10 109 | tvar -> LPAREN . COLON patt expr RPAREN 110 | 111 | COLON shift 20 112 | 113 | State 11 114 | decl -> LPAREN LETREC tvar . expr RPAREN 115 | 116 | LABEL shift 19 117 | UNIT shift 16 118 | SET shift 14 119 | expr goto 21 120 | ONE shift 15 121 | VOID shift 17 122 | LPAREN shift 13 123 | IDENT shift 18 124 | 125 | State 12 126 | decl -> LPAREN LET tvar expr . RPAREN 127 | 128 | RPAREN shift 22 129 | 130 | State 13 131 | expr -> LPAREN . LABEL expr RPAREN 132 | expr -> LPAREN . expr expr RPAREN 133 | expr -> LPAREN . CONS expr expr RPAREN 134 | expr -> LPAREN . LAMBDA patt expr RPAREN 135 | expr -> LPAREN . PI tvar expr RPAREN 136 | expr -> LPAREN . SIGMA tvar expr RPAREN 137 | expr -> LPAREN . ARROW expr expr RPAREN 138 | expr -> LPAREN . STAR expr expr RPAREN 139 | expr -> LPAREN . LABEL expr RPAREN 140 | expr -> LPAREN . SUM LBRACK branches RBRACK RPAREN 141 | expr -> LPAREN . FUN LBRACK branches RBRACK RPAREN 142 | expr -> LPAREN . CAR expr RPAREN 143 | expr -> LPAREN . CDR expr RPAREN 144 | 145 | LABEL shift 34 146 | ONE shift 15 147 | SIGMA shift 25 148 | CAR shift 30 149 | ARROW shift 32 150 | LAMBDA shift 24 151 | CDR shift 31 152 | expr goto 23 153 | PI shift 26 154 | IDENT shift 18 155 | STAR shift 33 156 | CONS shift 29 157 | SUM shift 28 158 | UNIT shift 16 159 | SET shift 14 160 | FUN shift 27 161 | VOID shift 17 162 | LPAREN shift 13 163 | 164 | State 14 165 | expr -> SET . 166 | 167 | UNIT reduce 21 168 | LABEL reduce 21 169 | SET reduce 21 170 | ONE reduce 21 171 | VOID reduce 21 172 | LPAREN reduce 21 173 | RPAREN reduce 21 174 | IDENT reduce 21 175 | 176 | State 15 177 | expr -> ONE . 178 | 179 | UNIT reduce 23 180 | LABEL reduce 23 181 | SET reduce 23 182 | ONE reduce 23 183 | VOID reduce 23 184 | LPAREN reduce 23 185 | RPAREN reduce 23 186 | IDENT reduce 23 187 | 188 | State 16 189 | expr -> UNIT . 190 | 191 | UNIT reduce 22 192 | LABEL reduce 22 193 | SET reduce 22 194 | ONE reduce 22 195 | VOID reduce 22 196 | LPAREN reduce 22 197 | RPAREN reduce 22 198 | IDENT reduce 22 199 | 200 | State 17 201 | expr -> VOID . 202 | 203 | UNIT reduce 29 204 | LABEL reduce 29 205 | SET reduce 29 206 | ONE reduce 29 207 | VOID reduce 29 208 | LPAREN reduce 29 209 | RPAREN reduce 29 210 | IDENT reduce 29 211 | 212 | State 18 213 | expr -> IDENT . 214 | 215 | UNIT reduce 11 216 | LABEL reduce 11 217 | SET reduce 11 218 | ONE reduce 11 219 | VOID reduce 11 220 | LPAREN reduce 11 221 | RPAREN reduce 11 222 | IDENT reduce 11 223 | 224 | State 19 225 | expr -> LABEL . 226 | 227 | UNIT reduce 12 228 | LABEL reduce 12 229 | SET reduce 12 230 | ONE reduce 12 231 | VOID reduce 12 232 | LPAREN reduce 12 233 | RPAREN reduce 12 234 | IDENT reduce 12 235 | 236 | State 20 237 | tvar -> LPAREN COLON . patt expr RPAREN 238 | 239 | WILD shift 37 240 | patt goto 35 241 | LPAREN shift 36 242 | IDENT shift 38 243 | 244 | State 21 245 | decl -> LPAREN LETREC tvar expr . RPAREN 246 | 247 | RPAREN shift 39 248 | 249 | State 22 250 | decl -> LPAREN LET tvar expr RPAREN . 251 | 252 | EOF reduce 5 253 | LPAREN reduce 5 254 | 255 | State 23 256 | expr -> LPAREN expr . expr RPAREN 257 | 258 | LABEL shift 19 259 | UNIT shift 16 260 | SET shift 14 261 | expr goto 40 262 | ONE shift 15 263 | VOID shift 17 264 | LPAREN shift 13 265 | IDENT shift 18 266 | 267 | State 24 268 | expr -> LPAREN LAMBDA . patt expr RPAREN 269 | 270 | WILD shift 37 271 | patt goto 41 272 | LPAREN shift 36 273 | IDENT shift 38 274 | 275 | State 25 276 | expr -> LPAREN SIGMA . tvar expr RPAREN 277 | 278 | tvar goto 42 279 | LPAREN shift 10 280 | 281 | State 26 282 | expr -> LPAREN PI . tvar expr RPAREN 283 | 284 | tvar goto 43 285 | LPAREN shift 10 286 | 287 | State 27 288 | expr -> LPAREN FUN . LBRACK branches RBRACK RPAREN 289 | 290 | LBRACK shift 44 291 | 292 | State 28 293 | expr -> LPAREN SUM . LBRACK branches RBRACK RPAREN 294 | 295 | LBRACK shift 45 296 | 297 | State 29 298 | expr -> LPAREN CONS . expr expr RPAREN 299 | 300 | LABEL shift 19 301 | UNIT shift 16 302 | SET shift 14 303 | expr goto 46 304 | ONE shift 15 305 | VOID shift 17 306 | LPAREN shift 13 307 | IDENT shift 18 308 | 309 | State 30 310 | expr -> LPAREN CAR . expr RPAREN 311 | 312 | LABEL shift 19 313 | UNIT shift 16 314 | SET shift 14 315 | expr goto 47 316 | ONE shift 15 317 | VOID shift 17 318 | LPAREN shift 13 319 | IDENT shift 18 320 | 321 | State 31 322 | expr -> LPAREN CDR . expr RPAREN 323 | 324 | LABEL shift 19 325 | UNIT shift 16 326 | SET shift 14 327 | expr goto 48 328 | ONE shift 15 329 | VOID shift 17 330 | LPAREN shift 13 331 | IDENT shift 18 332 | 333 | State 32 334 | expr -> LPAREN ARROW . expr expr RPAREN 335 | 336 | LABEL shift 19 337 | UNIT shift 16 338 | SET shift 14 339 | expr goto 49 340 | ONE shift 15 341 | VOID shift 17 342 | LPAREN shift 13 343 | IDENT shift 18 344 | 345 | State 33 346 | expr -> LPAREN STAR . expr expr RPAREN 347 | 348 | LABEL shift 19 349 | UNIT shift 16 350 | SET shift 14 351 | expr goto 50 352 | ONE shift 15 353 | VOID shift 17 354 | LPAREN shift 13 355 | IDENT shift 18 356 | 357 | State 34 358 | expr -> LABEL . 359 | expr -> LPAREN LABEL . expr RPAREN 360 | expr -> LPAREN LABEL . expr RPAREN 361 | 362 | begin conflict: 363 | UNIT shift 16 364 | UNIT reduce 12 365 | end conflict 366 | begin conflict: 367 | LABEL shift 19 368 | LABEL reduce 12 369 | end conflict 370 | begin conflict: 371 | SET shift 14 372 | SET reduce 12 373 | end conflict 374 | expr goto 51 375 | begin conflict: 376 | ONE shift 15 377 | ONE reduce 12 378 | end conflict 379 | begin conflict: 380 | VOID shift 17 381 | VOID reduce 12 382 | end conflict 383 | begin conflict: 384 | LPAREN shift 13 385 | LPAREN reduce 12 386 | end conflict 387 | begin conflict: 388 | IDENT shift 18 389 | IDENT reduce 12 390 | end conflict 391 | 392 | State 35 393 | tvar -> LPAREN COLON patt . expr RPAREN 394 | 395 | LABEL shift 19 396 | UNIT shift 16 397 | SET shift 14 398 | expr goto 52 399 | ONE shift 15 400 | VOID shift 17 401 | LPAREN shift 13 402 | IDENT shift 18 403 | 404 | State 36 405 | patt -> LPAREN . COMMA patt patt RPAREN 406 | 407 | COMMA shift 53 408 | 409 | State 37 410 | patt -> WILD . 411 | 412 | LABEL reduce 8 413 | ONE reduce 8 414 | WILD reduce 8 415 | UNIT reduce 8 416 | SET reduce 8 417 | VOID reduce 8 418 | LPAREN reduce 8 419 | IDENT reduce 8 420 | RPAREN reduce 8 421 | 422 | State 38 423 | patt -> IDENT . 424 | 425 | LABEL reduce 9 426 | ONE reduce 9 427 | WILD reduce 9 428 | UNIT reduce 9 429 | SET reduce 9 430 | VOID reduce 9 431 | LPAREN reduce 9 432 | IDENT reduce 9 433 | RPAREN reduce 9 434 | 435 | State 39 436 | decl -> LPAREN LETREC tvar expr RPAREN . 437 | 438 | EOF reduce 6 439 | LPAREN reduce 6 440 | 441 | State 40 442 | expr -> LPAREN expr expr . RPAREN 443 | 444 | RPAREN shift 54 445 | 446 | State 41 447 | expr -> LPAREN LAMBDA patt . expr RPAREN 448 | 449 | LABEL shift 19 450 | UNIT shift 16 451 | SET shift 14 452 | expr goto 55 453 | ONE shift 15 454 | VOID shift 17 455 | LPAREN shift 13 456 | IDENT shift 18 457 | 458 | State 42 459 | expr -> LPAREN SIGMA tvar . expr RPAREN 460 | 461 | LABEL shift 19 462 | UNIT shift 16 463 | SET shift 14 464 | expr goto 56 465 | ONE shift 15 466 | VOID shift 17 467 | LPAREN shift 13 468 | IDENT shift 18 469 | 470 | State 43 471 | expr -> LPAREN PI tvar . expr RPAREN 472 | 473 | LABEL shift 19 474 | UNIT shift 16 475 | SET shift 14 476 | expr goto 57 477 | ONE shift 15 478 | VOID shift 17 479 | LPAREN shift 13 480 | IDENT shift 18 481 | 482 | State 44 483 | expr -> LPAREN FUN LBRACK . branches RBRACK RPAREN 484 | 485 | LABEL shift 61 486 | branch goto 58 487 | branches goto 59 488 | LPAREN shift 60 489 | RBRACK reduce 34 490 | 491 | State 45 492 | expr -> LPAREN SUM LBRACK . branches RBRACK RPAREN 493 | 494 | LABEL shift 61 495 | branch goto 58 496 | branches goto 62 497 | LPAREN shift 60 498 | RBRACK reduce 34 499 | 500 | State 46 501 | expr -> LPAREN CONS expr . expr RPAREN 502 | 503 | LABEL shift 19 504 | UNIT shift 16 505 | SET shift 14 506 | expr goto 63 507 | ONE shift 15 508 | VOID shift 17 509 | LPAREN shift 13 510 | IDENT shift 18 511 | 512 | State 47 513 | expr -> LPAREN CAR expr . RPAREN 514 | 515 | RPAREN shift 64 516 | 517 | State 48 518 | expr -> LPAREN CDR expr . RPAREN 519 | 520 | RPAREN shift 65 521 | 522 | State 49 523 | expr -> LPAREN ARROW expr . expr RPAREN 524 | 525 | LABEL shift 19 526 | UNIT shift 16 527 | SET shift 14 528 | expr goto 66 529 | ONE shift 15 530 | VOID shift 17 531 | LPAREN shift 13 532 | IDENT shift 18 533 | 534 | State 50 535 | expr -> LPAREN STAR expr . expr RPAREN 536 | 537 | LABEL shift 19 538 | UNIT shift 16 539 | SET shift 14 540 | expr goto 67 541 | ONE shift 15 542 | VOID shift 17 543 | LPAREN shift 13 544 | IDENT shift 18 545 | 546 | State 51 547 | expr -> LPAREN LABEL expr . RPAREN 548 | expr -> LPAREN LABEL expr . RPAREN 549 | 550 | RPAREN shift 68 551 | 552 | State 52 553 | tvar -> LPAREN COLON patt expr . RPAREN 554 | 555 | RPAREN shift 69 556 | 557 | State 53 558 | patt -> LPAREN COMMA . patt patt RPAREN 559 | 560 | WILD shift 37 561 | patt goto 70 562 | LPAREN shift 36 563 | IDENT shift 38 564 | 565 | State 54 566 | expr -> LPAREN expr expr RPAREN . 567 | 568 | UNIT reduce 14 569 | LABEL reduce 14 570 | SET reduce 14 571 | ONE reduce 14 572 | VOID reduce 14 573 | LPAREN reduce 14 574 | RPAREN reduce 14 575 | IDENT reduce 14 576 | 577 | State 55 578 | expr -> LPAREN LAMBDA patt expr . RPAREN 579 | 580 | RPAREN shift 71 581 | 582 | State 56 583 | expr -> LPAREN SIGMA tvar expr . RPAREN 584 | 585 | RPAREN shift 72 586 | 587 | State 57 588 | expr -> LPAREN PI tvar expr . RPAREN 589 | 590 | RPAREN shift 73 591 | 592 | State 58 593 | branches -> branch . 594 | branches -> branch . branches 595 | 596 | LABEL shift 61 597 | branch goto 58 598 | branches goto 74 599 | LPAREN shift 60 600 | begin conflict: 601 | RBRACK reduce 34 602 | RBRACK reduce 35 603 | end conflict 604 | 605 | State 59 606 | expr -> LPAREN FUN LBRACK branches . RBRACK RPAREN 607 | 608 | RBRACK shift 75 609 | 610 | State 60 611 | branch -> LPAREN . LABEL expr RPAREN 612 | branch -> LPAREN . FATARROW LABEL expr RPAREN 613 | branch -> LPAREN . FATARROW LPAREN LABEL patt RPAREN expr RPAREN 614 | 615 | LABEL shift 77 616 | FATARROW shift 76 617 | 618 | State 61 619 | branch -> LABEL . 620 | 621 | LABEL reduce 30 622 | LPAREN reduce 30 623 | RBRACK reduce 30 624 | 625 | State 62 626 | expr -> LPAREN SUM LBRACK branches . RBRACK RPAREN 627 | 628 | RBRACK shift 78 629 | 630 | State 63 631 | expr -> LPAREN CONS expr expr . RPAREN 632 | 633 | RPAREN shift 79 634 | 635 | State 64 636 | expr -> LPAREN CAR expr RPAREN . 637 | 638 | UNIT reduce 27 639 | LABEL reduce 27 640 | SET reduce 27 641 | ONE reduce 27 642 | VOID reduce 27 643 | LPAREN reduce 27 644 | RPAREN reduce 27 645 | IDENT reduce 27 646 | 647 | State 65 648 | expr -> LPAREN CDR expr RPAREN . 649 | 650 | UNIT reduce 28 651 | LABEL reduce 28 652 | SET reduce 28 653 | ONE reduce 28 654 | VOID reduce 28 655 | LPAREN reduce 28 656 | RPAREN reduce 28 657 | IDENT reduce 28 658 | 659 | State 66 660 | expr -> LPAREN ARROW expr expr . RPAREN 661 | 662 | RPAREN shift 80 663 | 664 | State 67 665 | expr -> LPAREN STAR expr expr . RPAREN 666 | 667 | RPAREN shift 81 668 | 669 | State 68 670 | expr -> LPAREN LABEL expr RPAREN . 671 | expr -> LPAREN LABEL expr RPAREN . 672 | 673 | begin conflict: 674 | UNIT reduce 13 675 | UNIT reduce 24 676 | end conflict 677 | begin conflict: 678 | LABEL reduce 13 679 | LABEL reduce 24 680 | end conflict 681 | begin conflict: 682 | SET reduce 13 683 | SET reduce 24 684 | end conflict 685 | begin conflict: 686 | ONE reduce 13 687 | ONE reduce 24 688 | end conflict 689 | begin conflict: 690 | VOID reduce 13 691 | VOID reduce 24 692 | end conflict 693 | begin conflict: 694 | LPAREN reduce 13 695 | LPAREN reduce 24 696 | end conflict 697 | begin conflict: 698 | RPAREN reduce 13 699 | RPAREN reduce 24 700 | end conflict 701 | begin conflict: 702 | IDENT reduce 13 703 | IDENT reduce 24 704 | end conflict 705 | 706 | State 69 707 | tvar -> LPAREN COLON patt expr RPAREN . 708 | 709 | UNIT reduce 7 710 | LABEL reduce 7 711 | SET reduce 7 712 | ONE reduce 7 713 | VOID reduce 7 714 | LPAREN reduce 7 715 | IDENT reduce 7 716 | 717 | State 70 718 | patt -> LPAREN COMMA patt . patt RPAREN 719 | 720 | WILD shift 37 721 | patt goto 82 722 | LPAREN shift 36 723 | IDENT shift 38 724 | 725 | State 71 726 | expr -> LPAREN LAMBDA patt expr RPAREN . 727 | 728 | UNIT reduce 16 729 | LABEL reduce 16 730 | SET reduce 16 731 | ONE reduce 16 732 | VOID reduce 16 733 | LPAREN reduce 16 734 | RPAREN reduce 16 735 | IDENT reduce 16 736 | 737 | State 72 738 | expr -> LPAREN SIGMA tvar expr RPAREN . 739 | 740 | UNIT reduce 18 741 | LABEL reduce 18 742 | SET reduce 18 743 | ONE reduce 18 744 | VOID reduce 18 745 | LPAREN reduce 18 746 | RPAREN reduce 18 747 | IDENT reduce 18 748 | 749 | State 73 750 | expr -> LPAREN PI tvar expr RPAREN . 751 | 752 | UNIT reduce 17 753 | LABEL reduce 17 754 | SET reduce 17 755 | ONE reduce 17 756 | VOID reduce 17 757 | LPAREN reduce 17 758 | RPAREN reduce 17 759 | IDENT reduce 17 760 | 761 | State 74 762 | branches -> branch branches . 763 | 764 | RBRACK reduce 36 765 | 766 | State 75 767 | expr -> LPAREN FUN LBRACK branches RBRACK . RPAREN 768 | 769 | RPAREN shift 83 770 | 771 | State 76 772 | branch -> LPAREN FATARROW . LABEL expr RPAREN 773 | branch -> LPAREN FATARROW . LPAREN LABEL patt RPAREN expr RPAREN 774 | 775 | LABEL shift 85 776 | LPAREN shift 84 777 | 778 | State 77 779 | branch -> LPAREN LABEL . expr RPAREN 780 | 781 | LABEL shift 19 782 | UNIT shift 16 783 | SET shift 14 784 | expr goto 86 785 | ONE shift 15 786 | VOID shift 17 787 | LPAREN shift 13 788 | IDENT shift 18 789 | 790 | State 78 791 | expr -> LPAREN SUM LBRACK branches RBRACK . RPAREN 792 | 793 | RPAREN shift 87 794 | 795 | State 79 796 | expr -> LPAREN CONS expr expr RPAREN . 797 | 798 | UNIT reduce 15 799 | LABEL reduce 15 800 | SET reduce 15 801 | ONE reduce 15 802 | VOID reduce 15 803 | LPAREN reduce 15 804 | RPAREN reduce 15 805 | IDENT reduce 15 806 | 807 | State 80 808 | expr -> LPAREN ARROW expr expr RPAREN . 809 | 810 | UNIT reduce 19 811 | LABEL reduce 19 812 | SET reduce 19 813 | ONE reduce 19 814 | VOID reduce 19 815 | LPAREN reduce 19 816 | RPAREN reduce 19 817 | IDENT reduce 19 818 | 819 | State 81 820 | expr -> LPAREN STAR expr expr RPAREN . 821 | 822 | UNIT reduce 20 823 | LABEL reduce 20 824 | SET reduce 20 825 | ONE reduce 20 826 | VOID reduce 20 827 | LPAREN reduce 20 828 | RPAREN reduce 20 829 | IDENT reduce 20 830 | 831 | State 82 832 | patt -> LPAREN COMMA patt patt . RPAREN 833 | 834 | RPAREN shift 88 835 | 836 | State 83 837 | expr -> LPAREN FUN LBRACK branches RBRACK RPAREN . 838 | 839 | UNIT reduce 26 840 | LABEL reduce 26 841 | SET reduce 26 842 | ONE reduce 26 843 | VOID reduce 26 844 | LPAREN reduce 26 845 | RPAREN reduce 26 846 | IDENT reduce 26 847 | 848 | State 84 849 | branch -> LPAREN FATARROW LPAREN . LABEL patt RPAREN expr RPAREN 850 | 851 | LABEL shift 89 852 | 853 | State 85 854 | branch -> LPAREN FATARROW LABEL . expr RPAREN 855 | 856 | LABEL shift 19 857 | UNIT shift 16 858 | SET shift 14 859 | expr goto 90 860 | ONE shift 15 861 | VOID shift 17 862 | LPAREN shift 13 863 | IDENT shift 18 864 | 865 | State 86 866 | branch -> LPAREN LABEL expr . RPAREN 867 | 868 | RPAREN shift 91 869 | 870 | State 87 871 | expr -> LPAREN SUM LBRACK branches RBRACK RPAREN . 872 | 873 | UNIT reduce 25 874 | LABEL reduce 25 875 | SET reduce 25 876 | ONE reduce 25 877 | VOID reduce 25 878 | LPAREN reduce 25 879 | RPAREN reduce 25 880 | IDENT reduce 25 881 | 882 | State 88 883 | patt -> LPAREN COMMA patt patt RPAREN . 884 | 885 | LABEL reduce 10 886 | ONE reduce 10 887 | WILD reduce 10 888 | UNIT reduce 10 889 | SET reduce 10 890 | VOID reduce 10 891 | LPAREN reduce 10 892 | IDENT reduce 10 893 | RPAREN reduce 10 894 | 895 | State 89 896 | branch -> LPAREN FATARROW LPAREN LABEL . patt RPAREN expr RPAREN 897 | 898 | WILD shift 37 899 | patt goto 92 900 | LPAREN shift 36 901 | IDENT shift 38 902 | 903 | State 90 904 | branch -> LPAREN FATARROW LABEL expr . RPAREN 905 | 906 | RPAREN shift 93 907 | 908 | State 91 909 | branch -> LPAREN LABEL expr RPAREN . 910 | 911 | LABEL reduce 31 912 | LPAREN reduce 31 913 | RBRACK reduce 31 914 | 915 | State 92 916 | branch -> LPAREN FATARROW LPAREN LABEL patt . RPAREN expr RPAREN 917 | 918 | RPAREN shift 94 919 | 920 | State 93 921 | branch -> LPAREN FATARROW LABEL expr RPAREN . 922 | 923 | LABEL reduce 32 924 | LPAREN reduce 32 925 | RBRACK reduce 32 926 | 927 | State 94 928 | branch -> LPAREN FATARROW LPAREN LABEL patt RPAREN . expr RPAREN 929 | 930 | LABEL shift 19 931 | UNIT shift 16 932 | SET shift 14 933 | expr goto 95 934 | ONE shift 15 935 | VOID shift 17 936 | LPAREN shift 13 937 | IDENT shift 18 938 | 939 | State 95 940 | branch -> LPAREN FATARROW LPAREN LABEL patt RPAREN expr . RPAREN 941 | 942 | RPAREN shift 96 943 | 944 | State 96 945 | branch -> LPAREN FATARROW LPAREN LABEL patt RPAREN expr RPAREN . 946 | 947 | LABEL reduce 33 948 | LPAREN reduce 33 949 | RBRACK reduce 33 950 | 951 | 7 shift/reduce conflicts 952 | 10 reduce/reduce conflicts 953 | -------------------------------------------------------------------------------- /debug/debug.y: -------------------------------------------------------------------------------- 1 | %token IDENT 2 | %token LABEL 3 | %token ERROR 4 | %token TOKEN-ERROR 5 | %start (decls) 6 | %% 7 | decls: 8 | | decl 9 | | decl decls 10 | ; 11 | decl: 'LPAREN' 'LET' tvar expr 'RPAREN' 12 | | 'LPAREN' 'LETREC' tvar expr 'RPAREN' 13 | ; 14 | tvar: 'LPAREN' 'COLON' patt expr 'RPAREN' 15 | ; 16 | patt: 'WILD' 17 | | IDENT 18 | | 'LPAREN' 'COMMA' patt patt 'RPAREN' 19 | ; 20 | expr: IDENT 21 | | LABEL 22 | | 'LPAREN' LABEL expr 'RPAREN' 23 | | 'LPAREN' expr expr 'RPAREN' 24 | | 'LPAREN' 'CONS' expr expr 'RPAREN' 25 | | 'LPAREN' 'LAMBDA' patt expr 'RPAREN' 26 | | 'LPAREN' 'PI' tvar expr 'RPAREN' 27 | | 'LPAREN' 'SIGMA' tvar expr 'RPAREN' 28 | | 'LPAREN' 'ARROW' expr expr 'RPAREN' 29 | | 'LPAREN' 'STAR' expr expr 'RPAREN' 30 | | 'SET' 31 | | 'UNIT' 32 | | 'ONE' 33 | | 'LPAREN' LABEL expr 'RPAREN' 34 | | 'LPAREN' 'SUM' 'LBRACK' branches 'RBRACK' 'RPAREN' 35 | | 'LPAREN' 'FUN' 'LBRACK' branches 'RBRACK' 'RPAREN' 36 | | 'LPAREN' 'CAR' expr 'RPAREN' 37 | | 'LPAREN' 'CDR' expr 'RPAREN' 38 | | 'VOID' 39 | ; 40 | branch: LABEL 41 | | 'LPAREN' LABEL expr 'RPAREN' 42 | | 'LPAREN' 'FATARROW' LABEL expr 'RPAREN' 43 | | 'LPAREN' 'FATARROW' 'LPAREN' LABEL patt 'RPAREN' expr 'RPAREN' 44 | ; 45 | branches: 46 | | branch 47 | | branch branches 48 | ; 49 | %% 50 | -------------------------------------------------------------------------------- /doc/manual-racket.css: -------------------------------------------------------------------------------- 1 | /* See the beginning of "manual.css". */ 2 | 3 | /* Monospace: */ 4 | 5 | .RktIn, .RktRdr, .RktPn, .RktMeta, 6 | .RktMod, .RktKw, .RktVar, .RktSym, 7 | .RktRes, .RktOut, .RktCmt, .RktVal, 8 | .RktBlk, .RktErr { 9 | font-family: 'Fira-Mono', monospace; 10 | white-space: inherit; 11 | font-size: 1rem; 12 | line-height: 1.5; 13 | 14 | } 15 | 16 | /* this selctor grabs the first linked Racket symbol 17 | in a definition box (i.e., the symbol being defined) */ 18 | a.RktValDef, a.RktStxDef, a.RktSymDef, 19 | span.RktValDef, span.RktStxDef, span.RktSymDef 20 | { 21 | font-size: 1.1rem; 22 | color: black; 23 | font-weight: 500; 24 | } 25 | 26 | 27 | .inheritedlbl { 28 | font-family: 'Fira', sans-serif; 29 | } 30 | 31 | .RBackgroundLabelInner { 32 | font-family: inherit; 33 | } 34 | 35 | /* ---------------------------------------- */ 36 | /* Inherited methods, left margin */ 37 | 38 | .inherited { 39 | width: 95%; 40 | margin-top: 0.5em; 41 | text-align: left; 42 | background-color: inherit; 43 | } 44 | 45 | .inherited td { 46 | font-size: 82%; 47 | padding-left: 0.5rem; 48 | line-height: 1.3; 49 | text-indent: 0; 50 | padding-right: 0; 51 | } 52 | 53 | .inheritedlbl { 54 | font-style: normal; 55 | } 56 | 57 | /* ---------------------------------------- */ 58 | /* Racket text styles */ 59 | 60 | .RktIn { 61 | color: #cc6633; 62 | background-color: #eee; 63 | white-space: pre; 64 | } 65 | 66 | .RktInBG { 67 | background-color: #eee; 68 | } 69 | 70 | 71 | .refcolumn .RktInBG { 72 | background-color: white; 73 | } 74 | 75 | .RktRdr { 76 | } 77 | 78 | .RktPn { 79 | color: #843c24; 80 | } 81 | 82 | .RktMeta { 83 | color: black; 84 | } 85 | 86 | .RktMod { 87 | color: inherit; 88 | } 89 | 90 | .RktOpt { 91 | color: black; 92 | font-style: italic; 93 | } 94 | 95 | .RktKw { 96 | color: black; 97 | } 98 | 99 | .RktErr { 100 | color: red; 101 | font-style: italic; 102 | font-weight: 400; 103 | } 104 | 105 | .RktVar { 106 | position: relative; 107 | left: -1px; font-style: italic; 108 | color: #444; 109 | } 110 | 111 | .SVInsetFlow .RktVar { 112 | font-weight: 400; 113 | color: #444; 114 | } 115 | 116 | 117 | .RktSym { 118 | color: inherit; 119 | } 120 | 121 | 122 | 123 | .RktValLink, .RktStxLink, .RktModLink { 124 | text-decoration: none; 125 | color: #07A; 126 | font-size: 1rem; 127 | } 128 | 129 | /* for syntax links within headings */ 130 | h2 a.RktStxLink, h3 a.RktStxLink, h4 a.RktStxLink, h5 a.RktStxLink, 131 | h2 a.RktValLink, h3 a.RktValLink, h4 a.RktValLink, h5 a.RktValLink, 132 | h2 .RktSym, h3 .RktSym, h4 .RktSym, h5 .RktSym, 133 | h2 .RktMod, h3 .RktMod, h4 .RktMod, h5 .RktMod, 134 | h2 .RktVal, h3 .RktVal, h4 .RktVal, h5 .RktVal, 135 | h2 .RktPn, h3 .RktPn, h4 .RktPn, h5 .RktPn { 136 | color: #333; 137 | font-size: 1.50rem; 138 | font-weight: 400; 139 | } 140 | 141 | .toptoclink .RktStxLink, .toclink .RktStxLink, 142 | .toptoclink .RktValLink, .toclink .RktValLink, 143 | .toptoclink .RktModLink, .toclink .RktModLink { 144 | color: inherit; 145 | } 146 | 147 | .tocset .RktValLink, .tocset .RktStxLink, .tocset .RktModLink, .tocset .RktSym { 148 | color: black; 149 | font-weight: 400; 150 | font-size: 0.9rem; 151 | } 152 | 153 | .tocset td a.tocviewselflink .RktValLink, 154 | .tocset td a.tocviewselflink .RktStxLink, 155 | .tocset td a.tocviewselflink .RktMod, 156 | .tocset td a.tocviewselflink .RktSym { 157 | font-weight: lighter; 158 | color: white; 159 | } 160 | 161 | 162 | .RktRes { 163 | color: #0000af; 164 | } 165 | 166 | .RktOut { 167 | color: #960096; 168 | } 169 | 170 | .RktCmt { 171 | color: #c2741f; 172 | } 173 | 174 | .RktVal { 175 | color: #228b22; 176 | } 177 | 178 | /* ---------------------------------------- */ 179 | /* Some inline styles */ 180 | 181 | .together { /* for definitions grouped together in one box */ 182 | width: 100%; 183 | border-top: 2px solid white; 184 | } 185 | 186 | tbody > tr:first-child > td > .together { 187 | border-top: 0px; /* erase border on first instance of together */ 188 | } 189 | 190 | .RktBlk { 191 | white-space: pre; 192 | text-align: left; 193 | } 194 | 195 | .highlighted { 196 | font-size: 1rem; 197 | background-color: #fee; 198 | } 199 | 200 | .defmodule { 201 | font-family: 'Fira-Mono', monospace; 202 | padding: 0.25rem 0.75rem 0.25rem 0.5rem; 203 | margin-bottom: 1rem; 204 | width: 100%; 205 | background-color: #ebf0f4; 206 | } 207 | 208 | .defmodule a { 209 | color: #444; 210 | } 211 | 212 | 213 | .defmodule td span.hspace:first-child { 214 | position: absolute; 215 | width: 0; 216 | display: inline-block; 217 | } 218 | 219 | .defmodule .RpackageSpec .Smaller, 220 | .defmodule .RpackageSpec .stt { 221 | font-size: 1rem; 222 | } 223 | 224 | /* make parens ordinary color in defmodule */ 225 | .defmodule .RktPn { 226 | color: inherit; 227 | } 228 | 229 | .specgrammar { 230 | float: none; 231 | padding-left: 1em; 232 | } 233 | 234 | 235 | .RBibliography td { 236 | vertical-align: text-top; 237 | padding-top: 1em; 238 | } 239 | 240 | .leftindent { 241 | margin-left: 2rem; 242 | margin-right: 0em; 243 | } 244 | 245 | .insetpara { 246 | margin-left: 1em; 247 | margin-right: 1em; 248 | } 249 | 250 | .SCodeFlow .Rfilebox { 251 | margin-left: -1em; /* see 17.2 of guide, module languages */ 252 | } 253 | 254 | .Rfiletitle { 255 | text-align: right; 256 | background-color: #eee; 257 | } 258 | 259 | .SCodeFlow .Rfiletitle { 260 | border-top: 1px dotted gray; 261 | border-right: 1px dotted gray; 262 | } 263 | 264 | 265 | .Rfilename { 266 | border-top: 0; 267 | border-right: 0; 268 | padding-left: 0.5em; 269 | padding-right: 0.5em; 270 | background-color: inherit; 271 | } 272 | 273 | .Rfilecontent { 274 | margin: 0.5em; 275 | } 276 | 277 | .RpackageSpec { 278 | padding-right: 0; 279 | } 280 | 281 | /* ---------------------------------------- */ 282 | /* For background labels */ 283 | 284 | .RBackgroundLabel { 285 | float: right; 286 | width: 0px; 287 | height: 0px; 288 | } 289 | 290 | .RBackgroundLabelInner { 291 | position: relative; 292 | width: 25em; 293 | left: -25.5em; 294 | top: 0.20rem; /* sensitive to monospaced font choice */ 295 | text-align: right; 296 | z-index: 0; 297 | font-weight: 300; 298 | font-family: 'Fira-Mono', monospace; 299 | font-size: 0.9rem; 300 | color: gray; 301 | } 302 | 303 | 304 | .RpackageSpec .Smaller { 305 | font-weight: 300; 306 | font-family: 'Fira-Mono', monospace; 307 | font-size: 0.9rem; 308 | } 309 | 310 | .RForeground { 311 | position: relative; 312 | left: 0px; 313 | top: 0px; 314 | z-index: 1; 315 | } 316 | 317 | /* ---------------------------------------- */ 318 | /* For section source modules & tags */ 319 | 320 | .RPartExplain { 321 | background: #eee; 322 | font-size: 0.9rem; 323 | margin-top: 0.2rem; 324 | padding: 0.2rem; 325 | text-align: left; 326 | } 327 | -------------------------------------------------------------------------------- /doc/manual-racket.js: -------------------------------------------------------------------------------- 1 | /* For the Racket manual style */ 2 | 3 | AddOnLoad(function() { 4 | /* Look for header elements that have x-source-module and x-part tag. 5 | For those elements, add a hidden element that explains how to 6 | link to the section, and set the element's onclick() to display 7 | the explanation. */ 8 | var tag_names = ["h1", "h2", "h3", "h4", "h5"]; 9 | for (var j = 0; j < tag_names.length; j++) { 10 | elems = document.getElementsByTagName(tag_names[j]); 11 | for (var i = 0; i < elems.length; i++) { 12 | var elem = elems.item(i); 13 | AddPartTitleOnClick(elem); 14 | } 15 | } 16 | }) 17 | 18 | // cache of source urls 19 | var cache = {}; 20 | 21 | function ParseSource(source, mod_path, single_collection) { 22 | 23 | var source_url = new URL(source); 24 | 25 | if (source_url.protocol == "github:") { 26 | // browser URL parser only works with http(s) URLs 27 | source_url = new URL("https" + source.substring(6)); 28 | var host = source_url.host; 29 | var url_path = source_url.pathname.substring(1).split("/"); 30 | if (!(url_path.length >= 2)) return null; 31 | var user = url_path.shift(); 32 | var repo = url_path.shift(); 33 | var branch = url_path.shift(); 34 | var source_path = url_path.join("/"); 35 | } 36 | else if (("https:" == source_url.protocol) || ("git:" == source_url.protocol)) { 37 | // browser URL parser only works with http(s) URLs 38 | if ("git:" == source_url.protocol) 39 | source_url = new URL("https" + source.substring(3)); 40 | 41 | var host = source_url.host; 42 | var source_path = source_url.searchParams.get("path"); 43 | var branch = (source_url.hash || "#master").substring(1); 44 | var url_path = source_url.pathname.substring(1).split("/"); 45 | if (url_path.length < 2) throw [source_url.pathname, url_path]; 46 | var user = url_path.shift(); 47 | var repo = url_path.shift(); 48 | var mtch = repo.match(/(.*)\.git$/); 49 | if (mtch) repo = mtch[1]; 50 | 51 | } 52 | else return null; 53 | 54 | var mod_path_re = /^\(lib "(.+)"\)$/; 55 | 56 | var mod_path_elems = mod_path && mod_path.match(mod_path_re)[1].split("/"); 57 | 58 | if (!user || !repo || !mod_path_elems) 59 | return null; 60 | if (single_collection) 61 | mod_path_elems.shift(); 62 | 63 | var file_path = mod_path_elems.join("/"); 64 | 65 | 66 | if (source_path) { 67 | file_path = source_path + "/" + file_path; 68 | } 69 | 70 | return { user: user, 71 | repo: repo, 72 | file_path: file_path, 73 | branch: branch, 74 | host: host }; 75 | } 76 | 77 | function AddSourceElement(pkg_url, info) { 78 | info.appendChild(document.createTextNode("Document source ")); 79 | var url_line = document.createElement("div"); 80 | var a = document.createElement("a"); 81 | a.href = pkg_url; 82 | a.style.whiteSpace = "nowrap"; 83 | a.appendChild(document.createTextNode(pkg_url)); 84 | addSpan(url_line, "\xA0", "RktRdr"); 85 | url_line.appendChild(a); 86 | info.appendChild(url_line); 87 | } 88 | 89 | var prefixes = { "github.com": "tree", 90 | "gitlab.com": "-/blob" }; 91 | 92 | 93 | function AddSourceUrl(source, mod_path, collection, info) { 94 | // multi is encoded as an array, empty as false 95 | single_collection = (typeof collection === "string"); 96 | 97 | var parsed = source && mod_path && ParseSource(source, mod_path, single_collection); 98 | 99 | if (!parsed) return; 100 | 101 | prefix = prefixes.hasOwnProperty(parsed.host) && prefixes[parsed.host]; 102 | if (!prefix) return; 103 | 104 | var correct_url = "https://" + [parsed.host, parsed.user, parsed.repo, prefix, parsed.branch, parsed.file_path].join("/"); 105 | 106 | if (info) AddSourceElement(correct_url, info); 107 | } 108 | 109 | function addSpan(dest, str, cn) { 110 | var s = document.createElement("span"); 111 | s.className = cn; 112 | s.style.whiteSpace = "nowrap"; 113 | s.appendChild(document.createTextNode(str)); 114 | dest.appendChild(s); 115 | } 116 | 117 | 118 | // test cases 119 | if (false) { 120 | console.log(ParseSource("git://gitlab.com/benn/foo?path=xxx", 121 | '(lib "asn1/scribblings/asn1.scrbl")', 122 | false)) 123 | console.log(ParseSource("github://github.com/carl-eastlund/mischief/master", 124 | '(lib "asn1/scribblings/asn1.scrbl")', 125 | false)) 126 | console.log(ParseSource("github://github.com/carl-eastlund/mischief/stable/dir", 127 | '(lib "asn1/scribblings/asn1.scrbl")', 128 | false)) 129 | 130 | console.log(ParseSource("git://github.com/racket/racket/?path=pkgs/racket-doc", 131 | '(lib "asn1/scribblings/asn1.scrbl")', 132 | false)); 133 | 134 | console.log(ParseSource("git://github.com/rmculpepper/asn1.git?path=asn1-doc", 135 | '(lib "asn1/scribblings/asn1.scrbl")', 136 | true)); 137 | console.log(ParseSource("git://github.com/rmculpepper/asn1", 138 | '(lib "asn1/scribblings/asn1.scrbl")', 139 | true)); 140 | console.log(ParseSource("git://github.com/rmculpepper/asn1", 141 | '(lib "asn1/scribblings/asn1.scrbl")', 142 | false)); 143 | } 144 | 145 | function AddPartTitleOnClick(elem) { 146 | var mod_path = elem.getAttribute("x-source-module"); 147 | var tag = elem.getAttribute("x-part-tag"); 148 | var source_pkg = elem.getAttribute("x-source-pkg"); 149 | 150 | // create here to share 151 | var info = document.createElement("div"); 152 | 153 | 154 | // tag is not needed, but this way we can add the element in only one place 155 | // avoid failing on browser that don't have `fetch` 156 | if (mod_path && source_pkg && tag && window.fetch) { 157 | 158 | var cached = cache[mod_path] 159 | if (cached) { 160 | AddSourceElement(cached[0], mod_path, cached[1], info); 161 | } 162 | else { 163 | fetch("https://pkgs.racket-lang.org/pkg/" + source_pkg + ".json") 164 | .then(function (response) { return response.json(); }) 165 | .then(function (data) { 166 | var vers = data["versions"] || {}; 167 | var def = vers["default"] || {}; 168 | var source = def["source"] || undefined; 169 | var collection = data["collection"]; 170 | if (source) { 171 | cache[mod_path] = [source, collection]; 172 | AddSourceUrl(source, mod_path, collection, info); 173 | } 174 | }); 175 | } 176 | } 177 | 178 | if (mod_path && tag) { 179 | // Might not be present: 180 | var prefixes = elem.getAttribute("x-part-prefixes"); 181 | 182 | info.className = "RPartExplain"; 183 | 184 | /* The "top" tag refers to a whole document: */ 185 | var is_top = (tag == "\"top\""); 186 | info.appendChild(document.createTextNode("Link to this " 187 | + (is_top ? "document" : "section") 188 | + " with ")); 189 | 190 | /* Break `secref` into two lines if the module path and tag 191 | are long enough: */ 192 | var is_long = (is_top ? false : ((mod_path.length 193 | + tag.length 194 | + (prefixes ? (16 + prefixes.length) : 0)) 195 | > 60)); 196 | 197 | var line1 = document.createElement("div"); 198 | var line1x = ((is_long && prefixes) ? document.createElement("div") : line1); 199 | var line2 = (is_long ? document.createElement("div") : line1); 200 | 201 | /* Construct a `secref` call with suitable syntax coloring: */ 202 | addSpan(line1, "\xA0@", "RktRdr"); 203 | addSpan(line1, (is_top ? "other-doc" : "secref"), "RktSym"); 204 | addSpan(line1, "[", "RktPn"); 205 | if (!is_top) 206 | addSpan(line1, tag, "RktVal"); 207 | if (is_long) { 208 | /* indent additional lines: */ 209 | if (prefixes) 210 | addSpan(line1x, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn"); 211 | addSpan(line2, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn"); 212 | } 213 | if (prefixes) { 214 | addSpan(line1x, " #:tag-prefixes ", "RktPn"); 215 | addSpan(line1x, "'", "RktVal"); 216 | addSpan(line1x, prefixes, "RktVal"); 217 | } 218 | if (!is_top) 219 | addSpan(line2, " #:doc ", "RktPn"); 220 | addSpan(line2, "'", "RktVal"); 221 | addSpan(line2, mod_path, "RktVal"); 222 | addSpan(line2, "]", "RktPn"); 223 | 224 | info.appendChild(line1); 225 | if (is_long) 226 | info.appendChild(line1x); 227 | if (is_long) 228 | info.appendChild(line2); 229 | 230 | info.style.display = "none"; 231 | 232 | /* Add the new element afterthe header: */ 233 | var n = elem.nextSibling; 234 | if (n) 235 | elem.parentNode.insertBefore(info, n); 236 | else 237 | elem.parentNode.appendChild(info); 238 | 239 | /* Clicking the header shows the explanation element: */ 240 | elem.onclick = function () { 241 | if (info.style.display == "none") 242 | info.style.display = "block"; 243 | else 244 | info.style.display = "none"; 245 | } 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /doc/manual-style.css: -------------------------------------------------------------------------------- 1 | 2 | /* See the beginning of "scribble.css". 3 | This file is used by the `scribble/manual` language, along with 4 | "manual-racket.css". */ 5 | 6 | @import url("manual-fonts.css"); 7 | 8 | * { 9 | margin: 0; 10 | padding: 0; 11 | } 12 | 13 | @media all {html {font-size: 15px;}} 14 | @media all and (max-width:940px){html {font-size: 14px;}} 15 | @media all and (max-width:850px){html {font-size: 13px;}} 16 | @media all and (max-width:830px){html {font-size: 12px;}} 17 | @media all and (max-width:740px){html {font-size: 11px;}} 18 | 19 | /* CSS seems backward: List all the classes for which we want a 20 | particular font, so that the font can be changed in one place. (It 21 | would be nicer to reference a font definition from all the places 22 | that we want it.) 23 | 24 | As you read the rest of the file, remember to double-check here to 25 | see if any font is set. */ 26 | 27 | /* Monospace: */ 28 | .maincolumn, .refpara, .refelem, .tocset, .stt, .hspace, .refparaleft, .refelemleft { 29 | font-family: 'Fira-Mono', monospace; 30 | white-space: inherit; 31 | font-size: 1rem; 32 | } 33 | 34 | /* embolden the "Racket Guide" and "Racket Reference" links on the TOC */ 35 | /* there isn't an obvious tag in the markup that designates the top TOC page, which is called "start.scrbl" */ 36 | /* nor a tag that designates these two links as special */ 37 | /* so we'll use this slightly tortured sibling selector that hooks onto the h2 tag */ 38 | h2[x-source-module='(lib "scribblings/main/start.scrbl")'] ~ table a[href="guide/index.html"], 39 | h2[x-source-module='(lib "scribblings/main/start.scrbl")'] ~ table a[href="reference/index.html"] { 40 | font-weight: bold; 41 | } 42 | 43 | 44 | h2 .stt { 45 | font-size: 2.3rem; 46 | /* prevent automatic bolding from h2 */ 47 | font-weight: 400; 48 | } 49 | 50 | .toptoclink .stt { 51 | font-size: inherit; 52 | } 53 | .toclink .stt { 54 | font-size: 90%; 55 | } 56 | 57 | .RpackageSpec .stt { 58 | font-weight: 300; 59 | font-family: 'Fira-Mono', monospace; 60 | font-size: 0.9rem; 61 | } 62 | 63 | h3 .stt, h4 .stt, h5 .stt { 64 | color: #333; 65 | font-size: 1.65rem; 66 | font-weight: 400; 67 | } 68 | 69 | 70 | /* Serif: */ 71 | .main, .refcontent, .tocview, .tocsub, .sroman, i { 72 | font-family: 'Charter-Racket', serif; 73 | font-size: 1.18rem; 74 | /* Don't use font-feature-settings with Charter, 75 | it fouls up loading for reasons mysterious */ 76 | /* font-feature-settings: 'tnum' 1, 'liga' 0; */ 77 | } 78 | 79 | 80 | /* Sans-serif: */ 81 | .version, .versionNoNav, .ssansserif { 82 | font-family: 'Fira', sans-serif; 83 | } 84 | 85 | /* used mostly for DrRacket menu commands */ 86 | .ssansserif { 87 | font-family: 'Fira', sans-serif; 88 | font-size: 0.9em; 89 | } 90 | 91 | .tocset .ssansserif { 92 | font-size: 100%; 93 | } 94 | 95 | /* ---------------------------------------- */ 96 | 97 | p, .SIntrapara { 98 | display: block; 99 | margin: 0 0 1em 0; 100 | line-height: 1.4; 101 | } 102 | 103 | .compact { 104 | padding: 0 0 1em 0; 105 | } 106 | 107 | li { 108 | list-style-position: outside; 109 | margin-left: 1.2em; 110 | } 111 | 112 | h1, h2, h3, h4, h5, h6, h7, h8 { 113 | font-family: 'Fira', sans-serif; 114 | font-weight: 300; 115 | font-size: 1.6rem; 116 | color: #333; 117 | margin-top: inherit; 118 | margin-bottom: 1rem; 119 | line-height: 1.25; 120 | 121 | } 122 | 123 | h3, h4, h5, h6, h7, h8 { 124 | border-top: 1px solid black; 125 | } 126 | 127 | 128 | 129 | h2 { /* per-page main title */ 130 | font-family: 'Cooper-Hewitt'; 131 | margin-top: 4rem; 132 | font-size: 2.3rem; 133 | font-weight: bold; 134 | line-height: 1.2; 135 | width: 90%; 136 | /* a little nudge to make text visually lower than 4rem rule in left margin */ 137 | position: relative; 138 | top: 6px; 139 | } 140 | 141 | h3, h4, h5, h6, h7, h8 { 142 | margin-top: 2em; 143 | padding-top: 0.1em; 144 | margin-bottom: 0.75em; 145 | } 146 | 147 | /* ---------------------------------------- */ 148 | /* Main */ 149 | 150 | body { 151 | color: black; 152 | background-color: white; 153 | } 154 | 155 | .maincolumn { 156 | width: auto; 157 | margin-top: 4rem; 158 | margin-left: 17rem; 159 | margin-right: 2rem; 160 | margin-bottom: 10rem; /* to avoid fixed bottom nav bar */ 161 | max-width: 700px; 162 | min-width: 370px; /* below this size, code samples don't fit */ 163 | } 164 | 165 | a { 166 | text-decoration: inherit; 167 | } 168 | 169 | a, .toclink, .toptoclink, .tocviewlink, .tocviewselflink, .tocviewtoggle, .plainlink, 170 | .techinside, .techoutside:hover, .techinside:hover { 171 | color: #07A; 172 | } 173 | 174 | a:hover { 175 | text-decoration: underline; 176 | } 177 | 178 | 179 | /* ---------------------------------------- */ 180 | /* Navigation */ 181 | 182 | .navsettop, .navsetbottom { 183 | left: 0; 184 | width: 15rem; 185 | height: 6rem; 186 | font-family: 'Fira', sans-serif; 187 | font-size: 0.9rem; 188 | border-bottom: 0px solid hsl(216, 15%, 70%); 189 | background-color: inherit; 190 | padding: 0; 191 | } 192 | 193 | .navsettop { 194 | position: fixed; 195 | z-index: 2; 196 | background: #a7b0be; 197 | top: 0; 198 | left: 0; 199 | margin-bottom: 0; 200 | border-bottom: 0; 201 | } 202 | 203 | .navsettop a, .navsetbottom a { 204 | color: black; 205 | } 206 | 207 | .navsettop a:hover, .navsetbottom a:hover { 208 | background: hsl(216, 78%, 95%); 209 | text-decoration: none; 210 | } 211 | 212 | .navleft, .navright { 213 | position: static; 214 | float: none; 215 | margin: 0; 216 | white-space: normal; 217 | } 218 | 219 | 220 | .navleft a { 221 | display: inline-block; 222 | } 223 | 224 | .navright a { 225 | display: inline-block; 226 | text-align: center; 227 | } 228 | 229 | .navleft a, .navright a, .navright span { 230 | display: inline-block; 231 | padding: 0.5rem; 232 | min-width: 1rem; 233 | } 234 | 235 | 236 | .navright { 237 | white-space: nowrap; 238 | } 239 | 240 | 241 | .navsetbottom { 242 | display: none; 243 | } 244 | 245 | .nonavigation { 246 | color: #889; 247 | } 248 | 249 | .searchform { 250 | display: block; 251 | margin: 0; 252 | padding: 0; 253 | border-bottom: 1px solid #eee; 254 | height: 4rem; 255 | } 256 | 257 | .nosearchform { 258 | margin: 0; 259 | padding: 0; 260 | height: 4rem; 261 | } 262 | 263 | .searchbox { 264 | font-size: 0.9rem; 265 | width: 12rem; 266 | margin: 1rem; 267 | padding: 0.25rem 0.4rem ; 268 | vertical-align: middle; 269 | background-color: white; 270 | font-family: 'Fira-Mono', monospace; 271 | } 272 | 273 | 274 | #search_box { 275 | font-family: 'Fira-Mono', monospace; 276 | font-size: 1rem; 277 | padding: 0.25rem 0.3rem ; 278 | } 279 | 280 | /* Default to local view. Global will specialize */ 281 | .plt_global_only { display: none; } 282 | .plt_local_only { display: block; } 283 | 284 | /* ---------------------------------------- */ 285 | /* Version */ 286 | 287 | .versionbox { 288 | position: absolute; 289 | float: none; 290 | top: 0.25rem; 291 | left: 17rem; 292 | z-index: 11000; 293 | height: 2em; 294 | font-size: 70%; 295 | font-weight: lighter; 296 | width: inherit; 297 | margin: 0; 298 | } 299 | .version, .versionNoNav { 300 | font-size: inherit; 301 | } 302 | .version:before, .versionNoNav:before { 303 | content: "v"; 304 | } 305 | 306 | 307 | /* ---------------------------------------- */ 308 | /* Margin notes */ 309 | 310 | /* cancel scribble.css styles: */ 311 | .refpara, .refelem { 312 | position: static; 313 | float: none; 314 | height: auto; 315 | width: auto; 316 | margin: 0; 317 | } 318 | 319 | .refcolumn { 320 | position: static; 321 | display: block; 322 | width: auto; 323 | font-size: inherit; 324 | margin: 2rem; 325 | margin-left: 2rem; 326 | padding: 0.5em; 327 | padding-left: 0.75em; 328 | padding-right: 1em; 329 | background: hsl(60, 29%, 94%); 330 | border: 1px solid #ccb; 331 | border-left: 0.4rem solid #ccb; 332 | } 333 | 334 | 335 | /* slightly different handling for margin-note* on narrow screens */ 336 | @media all and (max-width:1340px) { 337 | span.refcolumn { 338 | float: right; 339 | width: 50%; 340 | margin-left: 1rem; 341 | margin-bottom: 0.8rem; 342 | margin-top: 1.2rem; 343 | } 344 | 345 | } 346 | 347 | .refcontent, .refcontent p { 348 | line-height: 1.5; 349 | margin: 0; 350 | } 351 | 352 | .refcontent p + p { 353 | margin-top: 1em; 354 | } 355 | 356 | .refcontent a { 357 | font-weight: 400; 358 | } 359 | 360 | .refpara, .refparaleft { 361 | top: -1em; 362 | } 363 | 364 | 365 | @media all and (max-width:600px) { 366 | .refcolumn { 367 | margin-left: 0; 368 | margin-right: 0; 369 | } 370 | } 371 | 372 | 373 | @media all and (min-width:1340px) { 374 | .refcolumn { 375 | margin: 0 -22.5rem 1rem 0; 376 | float: right; 377 | clear: right; 378 | width: 18rem; 379 | } 380 | } 381 | 382 | .refcontent { 383 | font-family: 'Fira', sans-serif; 384 | font-size: 1rem; 385 | line-height: 1.6; 386 | margin: 0 0 0 0; 387 | } 388 | 389 | 390 | .refparaleft, .refelemleft { 391 | position: relative; 392 | float: left; 393 | right: 2em; 394 | height: 0em; 395 | width: 13em; 396 | margin: 0em 0em 0em 0em; 397 | display: contents; 398 | } 399 | 400 | .refcolumnleft { 401 | background-color: hsl(60, 29%, 94%); 402 | display: block; 403 | position: relative; 404 | width: 13em; 405 | font-size: 85%; 406 | border: 0.5em solid hsl(60, 29%, 94%); 407 | margin: 0 0 0 0; 408 | } 409 | 410 | 411 | /* ---------------------------------------- */ 412 | /* Table of contents, left margin */ 413 | 414 | .tocset { 415 | position: fixed; 416 | z-index: 2; 417 | overflow-y: scroll; 418 | float: none; 419 | left: 0; 420 | top: 0rem; 421 | bottom: 0; 422 | width: 14rem; 423 | padding: 0rem 0.5rem 0.5rem 0.5rem; 424 | background-color: hsl(216, 15%, 70%); 425 | border-top: 6rem solid hsl(216, 15%, 70%); 426 | } 427 | 428 | .tocset td { 429 | vertical-align: text-top; 430 | padding-bottom: 0.4rem; 431 | padding-left: 0.2rem; 432 | line-height: 1.1; 433 | font-family: 'Fira', sans-serif; 434 | } 435 | 436 | .tocset td a { 437 | color: black; 438 | font-weight: 400; 439 | } 440 | 441 | 442 | .tocview { 443 | text-align: left; 444 | background-color: inherit; 445 | margin-top: 1em; 446 | } 447 | 448 | 449 | .tocview td, .tocsub td { 450 | line-height: 1.3; 451 | } 452 | 453 | 454 | .tocview table, .tocsub table { 455 | width: 90%; 456 | } 457 | 458 | .tocset td a.tocviewselflink { 459 | font-weight: lighter; 460 | font-size: 110%; /* monospaced styles below don't need to enlarge */ 461 | color: white; 462 | } 463 | 464 | .tocviewselflink { 465 | text-decoration: none; 466 | } 467 | 468 | .tocsub { 469 | text-align: left; 470 | margin-top: 0.5em; 471 | background-color: inherit; 472 | } 473 | 474 | .tocviewlist, .tocsublist { 475 | margin-left: 0.2em; 476 | margin-right: 0.2em; 477 | padding-top: 0.2em; 478 | padding-bottom: 0.2em; 479 | } 480 | .tocviewlist table { 481 | font-size: 82%; 482 | } 483 | 484 | .tocviewlisttopspace { 485 | margin-bottom: 1em; 486 | } 487 | 488 | .tocviewsublist, .tocviewsublistonly, .tocviewsublisttop, .tocviewsublistbottom { 489 | margin-left: 0.4em; 490 | border-left: 1px solid #99a; 491 | padding-left: 0.8em; 492 | } 493 | .tocviewsublist { 494 | margin-bottom: 1em; 495 | } 496 | .tocviewsublist table, 497 | .tocviewsublistonly table, 498 | .tocviewsublisttop table, 499 | .tocviewsublistbottom table, 500 | table.tocsublist { 501 | font-size: 1rem; 502 | } 503 | 504 | .tocviewsublist td, 505 | .tocviewsublistbottom td, 506 | .tocviewsublisttop td, 507 | .tocsub td, 508 | .tocviewsublistonly td { 509 | font-size: 90%; 510 | } 511 | 512 | /* shrink the monospaced text (`stt`) within nav */ 513 | .tocviewsublist td .stt, 514 | .tocviewsublistbottom td .stt, 515 | .tocviewsublisttop td .stt, 516 | .tocsub td .stt, 517 | .tocviewsublistonly td .stt { 518 | font-size: 95%; 519 | } 520 | 521 | 522 | .tocviewtoggle { 523 | font-size: 75%; /* looks better, and avoids bounce when toggling sub-sections due to font alignments */ 524 | } 525 | 526 | .tocsublist td { 527 | padding-left: 0.5rem; 528 | padding-top: 0.25rem; 529 | text-indent: 0; 530 | } 531 | 532 | .tocsublinknumber { 533 | font-size: 100%; 534 | } 535 | 536 | .tocsublink { 537 | font-size: 82%; 538 | text-decoration: none; 539 | } 540 | 541 | .tocsubseclink { 542 | font-size: 100%; 543 | text-decoration: none; 544 | } 545 | 546 | .tocsubnonseclink { 547 | font-size: 82%; 548 | text-decoration: none; 549 | margin-left: 1rem; 550 | padding-left: 0; 551 | display: inline-block; 552 | } 553 | 554 | /* the label "on this page" */ 555 | .tocsubtitle { 556 | display: block; 557 | font-size: 62%; 558 | font-family: 'Fira', sans-serif; 559 | font-weight: bolder; 560 | font-style: normal; 561 | letter-spacing: 2px; 562 | text-transform: uppercase; 563 | margin: 0.5em; 564 | } 565 | 566 | .toptoclink { 567 | font-weight: bold; 568 | font-size: 110%; 569 | margin-bottom: 0.5rem; 570 | margin-top: 1.5rem; 571 | display: inline-block; 572 | } 573 | 574 | .toclink { 575 | font-size: inherit; 576 | } 577 | 578 | /* ---------------------------------------- */ 579 | /* Some inline styles */ 580 | 581 | .indexlink { 582 | text-decoration: none; 583 | } 584 | 585 | pre { 586 | margin-left: 2em; 587 | } 588 | 589 | blockquote { 590 | margin-left: 2em; 591 | margin-right: 2em; 592 | margin-bottom: 1em; 593 | } 594 | 595 | .SCodeFlow { 596 | border-left: 1px dotted black; 597 | padding-left: 1em; 598 | padding-right: 1em; 599 | margin-top: 1em; 600 | margin-bottom: 1em; 601 | margin-left: 0em; 602 | margin-right: 2em; 603 | white-space: nowrap; 604 | line-height: 1.5; 605 | } 606 | 607 | .SCodeFlow img { 608 | margin-top: 0.5em; 609 | margin-bottom: 0.5em; 610 | } 611 | 612 | /* put a little air between lines of code sample */ 613 | /* Fira Mono appears taller than Source Code Pro */ 614 | .SCodeFlow td { 615 | padding-bottom: 1px; 616 | } 617 | 618 | .boxed { 619 | margin: 0; 620 | margin-top: 2em; 621 | padding: 0.25em; 622 | padding-top: 0.3em; 623 | padding-bottom: 0.4em; 624 | background: #f3f3f3; 625 | box-sizing:border-box; 626 | border-top: 1px solid #99b; 627 | background: hsl(216, 78%, 95%); 628 | background: -moz-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%); 629 | background: -webkit-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%); 630 | background: -o-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%); 631 | background: -ms-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%); 632 | background: linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%); 633 | } 634 | 635 | blockquote > blockquote.SVInsetFlow { 636 | /* resolves issue in e.g. /reference/notation.html */ 637 | margin-top: 0em; 638 | } 639 | 640 | .leftindent .SVInsetFlow { /* see e.g. section 4.5 of Racket Guide */ 641 | margin-top: 1em; 642 | margin-bottom: 1em; 643 | } 644 | 645 | .SVInsetFlow a, .SCodeFlow a { 646 | color: #07A; 647 | } 648 | 649 | .SubFlow { 650 | display: block; 651 | margin: 0em; 652 | } 653 | 654 | .boxed { 655 | width: 100%; 656 | background-color: inherit; 657 | } 658 | 659 | .techoutside { text-decoration: none; } 660 | 661 | .SAuthorListBox { 662 | position: static; 663 | float: none; 664 | font-family: 'Fira', sans-serif; 665 | font-weight: 300; 666 | font-size: 110%; 667 | margin-top: 1rem; 668 | margin-bottom: 2rem; 669 | width: 30rem; 670 | height: auto; 671 | } 672 | 673 | .author > a { /* email links within author block */ 674 | font-weight: inherit; 675 | color: inherit; 676 | } 677 | 678 | .SAuthorList { 679 | font-size: 82%; 680 | } 681 | .SAuthorList:before { 682 | content: "by "; 683 | } 684 | .author { 685 | display: inline; 686 | white-space: nowrap; 687 | } 688 | 689 | /* phone + tablet styles */ 690 | 691 | @media all and (max-width:720px){ 692 | 693 | 694 | @media all and (max-width:720px){ 695 | 696 | @media all {html {font-size: 15px;}} 697 | @media all and (max-width:700px){html {font-size: 14px;}} 698 | @media all and (max-width:630px){html {font-size: 13px;}} 699 | @media all and (max-width:610px){html {font-size: 12px;}} 700 | @media all and (max-width:550px){html {font-size: 11px;}} 701 | @media all and (max-width:520px){html {font-size: 10px;}} 702 | 703 | .navsettop, .navsetbottom { 704 | display: flex; 705 | position: absolute; 706 | width: 100%; 707 | height: 4rem; 708 | border: 0; 709 | background-color: hsl(216, 15%, 70%); 710 | align-items: center; 711 | } 712 | 713 | .tocsetoverlay .navsettop { 714 | position: fixed; 715 | } 716 | 717 | .navleft { 718 | flex: 1; 719 | } 720 | 721 | .searchform { 722 | display: inline; 723 | border: 0; 724 | } 725 | 726 | .searchbox { 727 | margin-top: 0; 728 | margin-bottom: 0; 729 | } 730 | 731 | .navleft .tocsettoggle { 732 | display: initial; 733 | } 734 | 735 | .navright { 736 | margin-right: 1.3rem; 737 | border: 0px solid red; 738 | } 739 | 740 | .navsetbottom { 741 | display: block; 742 | margin-top: 8rem; 743 | } 744 | 745 | .tocset { 746 | display: none; 747 | border-top-width: 4rem; 748 | } 749 | 750 | .tocsetoverlay .tocset { 751 | display: block; 752 | } 753 | 754 | .versionbox { 755 | top: 4.5rem; 756 | left: 1rem; /* same distance as main-column */ 757 | z-index: 1; 758 | height: 2em; 759 | font-size: 70%; 760 | font-weight: lighter; 761 | } 762 | 763 | 764 | .maincolumn { 765 | margin-left: 1em; 766 | margin-top: 7rem; 767 | margin-bottom: 0rem; 768 | } 769 | 770 | } 771 | 772 | } 773 | 774 | /* print styles : hide the navigation elements */ 775 | @media print { 776 | .tocset, 777 | .navsettop, 778 | .navsetbottom { display: none; } 779 | .maincolumn { 780 | width: auto; 781 | margin-right: 13em; 782 | margin-left: 0; 783 | } 784 | } 785 | -------------------------------------------------------------------------------- /doc/notes.scrbl: -------------------------------------------------------------------------------- 1 | #lang scribble/manual 2 | 3 | @title{Bidirectional Typechecking of Dependent Types} 4 | 5 | This algorithm is based of the language specification by Thierry 6 | Coquand of the @italic{Mini-TT} language. 7 | 8 | @section{The main function} 9 | 10 | @codeblock{ 11 | (: check-main (-> Expr Val Void)) 12 | (define (check-main e t) 13 | (check 0 (tnil) (hash) e t)) 14 | } 15 | 16 | This highlights the important different types of values already 17 | present within the algorithm. 18 | 19 | First, @code{Expr}, which can be described by the following declaration: 20 | 21 | @codeblock{ 22 | (define-type Expr 23 | (U elam eset epi esigma eone eunit 24 | econ esum efun efst esnd eapp 25 | evar evoid edecl etuple)) 26 | } 27 | 28 | Next, @code{Val}, which can be described by the following type declaration: 29 | 30 | @codeblock{ 31 | (define-type Val (U vlam vpair vcon vunit vset 32 | vone vpi vsigma vfun vsum vnt)) 33 | } 34 | 35 | The main difference between @code{Expr} and @code{Val} is that the latter represent 36 | ``an open expression in weak head normal form", and, 37 | ``it is either a @italic{neutral value} 38 | @math{[k]} which represents an expression whose computation stopped because of an attempt 39 | to compute a variable, or a @italic{canonical value}, the form which makes clear the head construction 40 | of an expression, meaning that it is a lambda abstraction, a pi abstraction etc." 41 | 42 | Note further that @code{check-main} is just a call to @code{check}. 43 | 44 | @section{The function @code{check}} 45 | 46 | The function @code{check} is defined as 47 | 48 | @codeblock{ 49 | (: check (-> Integer Telescope Gamma Expr Val Void)) 50 | (define (check k rho gamma e* t*) 51 | (match* (e* t*) 52 | [((elam p e) (vpi t g)) 53 | (define gen (gen-v k)) 54 | (define gamma* (up-g gamma p t gen)) 55 | (check (add1 k) (tupvar rho p gen) gamma* e (inst g gen))] 56 | [((etuple e1 e2) (vsigma t g)) 57 | (check k rho gamma e1 t) 58 | (check k rho gamma e2 (inst g (evaluate e1 rho)))] 59 | [((econ c e) (vsum (sclos cas rho*))) 60 | (define a : (Option Expr) 61 | (hash-ref cas c (lambda () #f))) 62 | (when a 63 | (check k rho gamma e (evaluate a rho*)))] 64 | [((efun ces) (vpi (vsum (sclos cas rho*)) g)) 65 | (define ces* (hash-keys ces)) 66 | (define cas* (hash-keys cas)) 67 | (if (equal? ces* cas*) 68 | (for* ([x (hash->list ces)] 69 | [y (hash->list cas)]) 70 | (match* (x y) 71 | [((cons c e) (cons _ a)) 72 | (check k rho gamma e 73 | (vpi (evaluate a rho*) 74 | (cmp g c)))])) 75 | (error (format "branches do not match:\n\n\t~a\n\n\t~a" 76 | cas ces)))] 77 | [((eunit) (vset)) 78 | (void)] 79 | [((eone) (vunit)) 80 | (void)] 81 | [((epi p a b) (vset)) 82 | (check k rho gamma a (vset)) 83 | (define gen (gen-v k)) 84 | (define gamma* (up-g gamma p (evaluate a rho) gen)) 85 | (check (add1 k) (tupvar rho p gen) gamma* b (vset))] 86 | [((esigma p a b) (vset)) 87 | (check k rho gamma (epi p a b) (vset))] 88 | [((esum cas) (vset)) 89 | (for ([a (hash-values cas)]) 90 | (check k rho gamma a (vset)))] 91 | [((edecl d e) t) 92 | (define gamma* (check-decl k rho gamma d)) 93 | (check k (tupdec rho d) gamma* e t)] 94 | [(_ _) 95 | (define t** (check-infer k rho gamma e*)) 96 | (when (equal-nf? k t* t**) 97 | (void))])) 98 | } 99 | 100 | Here we match @code{e*} and @code{t*}, which are the @italic{expression} which is being 101 | typechecked, and the @italic{type} which we are comparing the expression to. 102 | 103 | As @code{check} is defined by cases, so we shall proceed through each case. 104 | 105 | @subsection{Lambda Abstraction} 106 | 107 | @codeblock{ 108 | [((elam p e) (vpi t g)) 109 | (define gen (gen-v k)) 110 | (define gamma* (up-g gamma p t gen)) 111 | (check (add1 k) (tupvar rho p gen) gamma* e (inst g gen))] 112 | } 113 | 114 | In typechecking a lambda abstraction, we generate a fresh variable @code{gen}, 115 | and then update @code{gamma}, our type environment, with the new variable. 116 | 117 | We then declare that the domain of the abstraction @italic{is just that fresh variable} 118 | to be checked, and then instantiate a new value based off of the codomain of the Pi type abstraction. 119 | 120 | @subsection{Tuples} 121 | 122 | @codeblock{ 123 | [((etuple e1 e2) (vsigma t g)) 124 | (check k rho gamma e1 t) 125 | (check k rho gamma e2 (inst g (evaluate e1 rho)))] 126 | } 127 | 128 | @subsection{Constructors} 129 | 130 | @codeblock{ 131 | [((econ c e) (vsum (sclos cas rho*))) 132 | (define a : (Option Expr) 133 | (hash-ref cas c (lambda () #f))) 134 | (when a 135 | (check k rho gamma e (evaluate a rho*)))] 136 | } 137 | 138 | @subsection{Pattern matching} 139 | 140 | @codeblock{ 141 | [((efun ces) (vpi (vsum (sclos cas rho*)) g)) 142 | (define ces* (hash-keys ces)) 143 | (define cas* (hash-keys cas)) 144 | (if (equal? ces* cas*) 145 | (for* ([x (hash->list ces)] 146 | [y (hash->list cas)]) 147 | (match* (x y) 148 | [((cons c e) (cons _ a)) 149 | (check k rho gamma e 150 | (vpi (evaluate a rho*) 151 | (cmp g c)))])) 152 | (error (format "branches do not match:\n\n\t~a\n\n\t~a" 153 | cas ces)))] 154 | } 155 | 156 | @subsection{Unit and One} 157 | 158 | @codeblock{ 159 | [((eunit) (vset)) 160 | (void)] 161 | [((eone) (vunit)) 162 | (void)] 163 | } 164 | 165 | @subsection{Pi Abstraction} 166 | 167 | @codeblock{ 168 | [((epi p a b) (vset)) 169 | (check k rho gamma a (vset)) 170 | (define gen (gen-v k)) 171 | (define gamma* (up-g gamma p (evaluate a rho) gen)) 172 | (check (add1 k) (tupvar rho p gen) gamma* b (vset))] 173 | } 174 | 175 | @subsection{Sigma Abstraction} 176 | 177 | @codeblock{ 178 | [((esigma p a b) (vset)) 179 | (check k rho gamma (epi p a b) (vset))] 180 | } 181 | 182 | @subsection{Sums} 183 | 184 | @codeblock{ 185 | [((esum cas) (vset)) 186 | (for ([a (hash-values cas)]) 187 | (check k rho gamma a (vset)))] 188 | } 189 | 190 | @subsection{Declarations} 191 | 192 | @codeblock{ 193 | [((edecl d e) t) 194 | (define gamma* (check-decl k rho gamma d)) 195 | (check k (tupdec rho d) gamma* e t)] 196 | } 197 | 198 | @subsection{Otherwise...} 199 | 200 | @codeblock{ 201 | [(_ _) 202 | (define t** (check-infer k rho gamma e*)) 203 | (when (equal-nf? k t* t**) 204 | (void))] 205 | } 206 | -------------------------------------------------------------------------------- /doc/racket.css: -------------------------------------------------------------------------------- 1 | 2 | /* See the beginning of "scribble.css". */ 3 | 4 | /* Monospace: */ 5 | .RktIn, .RktRdr, .RktPn, .RktMeta, 6 | .RktMod, .RktKw, .RktVar, .RktSym, 7 | .RktRes, .RktOut, .RktCmt, .RktVal, 8 | .RktBlk { 9 | font-family: monospace; 10 | white-space: inherit; 11 | } 12 | 13 | /* Serif: */ 14 | .inheritedlbl { 15 | font-family: serif; 16 | } 17 | 18 | /* Sans-serif: */ 19 | .RBackgroundLabelInner { 20 | font-family: sans-serif; 21 | } 22 | 23 | /* ---------------------------------------- */ 24 | /* Inherited methods, left margin */ 25 | 26 | .inherited { 27 | width: 100%; 28 | margin-top: 0.5em; 29 | text-align: left; 30 | background-color: #ECF5F5; 31 | } 32 | 33 | .inherited td { 34 | font-size: 82%; 35 | padding-left: 1em; 36 | text-indent: -0.8em; 37 | padding-right: 0.2em; 38 | } 39 | 40 | .inheritedlbl { 41 | font-style: italic; 42 | } 43 | 44 | /* ---------------------------------------- */ 45 | /* Racket text styles */ 46 | 47 | .RktIn { 48 | color: #cc6633; 49 | background-color: #eeeeee; 50 | white-space: pre; 51 | } 52 | 53 | .RktInBG { 54 | background-color: #eeeeee; 55 | } 56 | 57 | .RktRdr { 58 | } 59 | 60 | .RktPn { 61 | color: #843c24; 62 | } 63 | 64 | .RktMeta { 65 | color: black; 66 | } 67 | 68 | .RktMod { 69 | color: black; 70 | } 71 | 72 | .RktOpt { 73 | color: black; 74 | font-style: italic; 75 | } 76 | 77 | .RktKw { 78 | color: black; 79 | } 80 | 81 | .RktErr { 82 | color: red; 83 | font-style: italic; 84 | } 85 | 86 | .RktVar { 87 | color: #262680; 88 | font-style: italic; 89 | } 90 | 91 | .RktSym { 92 | color: #262680; 93 | } 94 | 95 | .RktSymDef { /* used with RktSym at def site */ 96 | } 97 | 98 | .RktValLink { 99 | text-decoration: none; 100 | color: blue; 101 | } 102 | 103 | .RktValDef { /* used with RktValLink at def site */ 104 | } 105 | 106 | .RktModLink { 107 | text-decoration: none; 108 | color: blue; 109 | } 110 | 111 | .RktStxLink { 112 | text-decoration: none; 113 | color: black; 114 | } 115 | 116 | .RktStxDef { /* used with RktStxLink at def site */ 117 | } 118 | 119 | .RktRes { 120 | color: #0000af; 121 | } 122 | 123 | .RktOut { 124 | color: #960096; 125 | } 126 | 127 | .RktCmt { 128 | color: #c2741f; 129 | } 130 | 131 | .RktVal { 132 | color: #228b22; 133 | } 134 | 135 | /* ---------------------------------------- */ 136 | /* Some inline styles */ 137 | 138 | .together { 139 | width: 100%; 140 | } 141 | 142 | .prototype, .argcontract, .RBoxed { 143 | white-space: nowrap; 144 | } 145 | 146 | .prototype td { 147 | vertical-align: text-top; 148 | } 149 | 150 | .RktBlk { 151 | white-space: inherit; 152 | text-align: left; 153 | } 154 | 155 | .RktBlk tr { 156 | white-space: inherit; 157 | } 158 | 159 | .RktBlk td { 160 | vertical-align: baseline; 161 | white-space: inherit; 162 | } 163 | 164 | .argcontract td { 165 | vertical-align: text-top; 166 | } 167 | 168 | .highlighted { 169 | background-color: #ddddff; 170 | } 171 | 172 | .defmodule { 173 | width: 100%; 174 | background-color: #F5F5DC; 175 | } 176 | 177 | .specgrammar { 178 | float: right; 179 | } 180 | 181 | .RBibliography td { 182 | vertical-align: text-top; 183 | } 184 | 185 | .leftindent { 186 | margin-left: 1em; 187 | margin-right: 0em; 188 | } 189 | 190 | .insetpara { 191 | margin-left: 1em; 192 | margin-right: 1em; 193 | } 194 | 195 | .Rfilebox { 196 | } 197 | 198 | .Rfiletitle { 199 | text-align: right; 200 | margin: 0em 0em 0em 0em; 201 | } 202 | 203 | .Rfilename { 204 | border-top: 1px solid #6C8585; 205 | border-right: 1px solid #6C8585; 206 | padding-left: 0.5em; 207 | padding-right: 0.5em; 208 | background-color: #ECF5F5; 209 | } 210 | 211 | .Rfilecontent { 212 | margin: 0em 0em 0em 0em; 213 | } 214 | 215 | .RpackageSpec { 216 | padding-right: 0.5em; 217 | } 218 | 219 | /* ---------------------------------------- */ 220 | /* For background labels */ 221 | 222 | .RBackgroundLabel { 223 | float: right; 224 | width: 0px; 225 | height: 0px; 226 | } 227 | 228 | .RBackgroundLabelInner { 229 | position: relative; 230 | width: 25em; 231 | left: -25.5em; 232 | top: 0px; 233 | text-align: right; 234 | color: white; 235 | z-index: 0; 236 | font-weight: bold; 237 | } 238 | 239 | .RForeground { 240 | position: relative; 241 | left: 0px; 242 | top: 0px; 243 | z-index: 1; 244 | } 245 | 246 | /* ---------------------------------------- */ 247 | /* History */ 248 | 249 | .SHistory { 250 | font-size: 82%; 251 | } 252 | -------------------------------------------------------------------------------- /doc/scribble-common.js: -------------------------------------------------------------------------------- 1 | // Common functionality for PLT documentation pages 2 | 3 | // Page Parameters ------------------------------------------------------------ 4 | 5 | var page_query_string = location.search.substring(1); 6 | 7 | var page_args = 8 | ((function(){ 9 | if (!page_query_string) return []; 10 | var args = page_query_string.split(/[&;]/); 11 | for (var i=0; i= 0) args[i] = [a.substring(0,p), a.substring(p+1)]; 15 | else args[i] = [a, false]; 16 | } 17 | return args; 18 | })()); 19 | 20 | function GetPageArg(key, def) { 21 | for (var i=0; i= 0 && cur.substring(0,eql) == key) 88 | return unescape(cur.substring(eql+1)); 89 | } 90 | return def; 91 | } 92 | } 93 | 94 | function SetCookie(key, val) { 95 | try { 96 | localStorage[key] = val; 97 | } catch(e) { 98 | var d = new Date(); 99 | d.setTime(d.getTime()+(365*24*60*60*1000)); 100 | try { 101 | document.cookie = 102 | key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; 103 | } catch (e) {} 104 | } 105 | } 106 | 107 | // note that this always stores a directory name, ending with a "/" 108 | function SetPLTRoot(ver, relative) { 109 | var root = location.protocol + "//" + location.host 110 | + NormalizePath(location.pathname.replace(/[^\/]*$/, relative)); 111 | SetCookie("PLT_Root."+ver, root); 112 | } 113 | 114 | // adding index.html works because of the above 115 | function GotoPLTRoot(ver, relative) { 116 | var u = GetCookie("PLT_Root."+ver, null); 117 | if (u == null) return true; // no cookie: use plain up link 118 | // the relative path is optional, default goes to the toplevel start page 119 | if (!relative) relative = "index.html"; 120 | location = u + relative; 121 | return false; 122 | } 123 | 124 | // Utilities ------------------------------------------------------------------ 125 | 126 | var normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/]; 127 | function NormalizePath(path) { 128 | var tmp, i; 129 | for (i = 0; i < normalize_rxs.length; i++) 130 | while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp; 131 | return path; 132 | } 133 | 134 | // `noscript' is problematic in some browsers (always renders as a 135 | // block), use this hack instead (does not always work!) 136 | // document.write(""); 137 | 138 | // Interactions --------------------------------------------------------------- 139 | 140 | function DoSearchKey(event, field, ver, top_path) { 141 | var val = field.value; 142 | if (event && event.key === 'Enter') { 143 | var u = GetCookie("PLT_Root."+ver, null); 144 | if (u == null) u = top_path; // default: go to the top path 145 | u += "search/index.html?q=" + encodeURIComponent(val); 146 | u = MergePageArgsIntoUrl(u); 147 | location = u; 148 | return false; 149 | } 150 | return true; 151 | } 152 | 153 | function TocviewToggle(glyph, id) { 154 | var s = document.getElementById(id).style; 155 | var expand = s.display == "none"; 156 | s.display = expand ? "block" : "none"; 157 | glyph.innerHTML = expand ? "▼" : "►"; 158 | } 159 | 160 | function TocsetToggle() { 161 | document.body.classList.toggle("tocsetoverlay"); 162 | } 163 | 164 | // Page Init ------------------------------------------------------------------ 165 | 166 | // Note: could make a function that inspects and uses window.onload to chain to 167 | // a previous one, but this file needs to be required first anyway, since it 168 | // contains utilities for all other files. 169 | var on_load_funcs = []; 170 | function AddOnLoad(fun) { on_load_funcs.push(fun); } 171 | window.onload = function() { 172 | for (var i=0; i 442 | .techinside doesn't work with IE, so use both (and IE doesn't 443 | work with inherit in the second one, so use blue directly) */ 444 | .techinside { color: black; } 445 | .techinside:hover { color: blue; } 446 | .techoutside:hover>.techinside { color: inherit; } 447 | 448 | .SCentered { 449 | text-align: center; 450 | } 451 | 452 | .imageleft { 453 | float: left; 454 | margin-right: 0.3em; 455 | } 456 | 457 | .Smaller { 458 | font-size: 82%; 459 | } 460 | 461 | .Larger { 462 | font-size: 122%; 463 | } 464 | 465 | /* A hack, inserted to break some Scheme ids: */ 466 | .mywbr { 467 | display: inline-block; 468 | height: 0; 469 | width: 0; 470 | font-size: 1px; 471 | } 472 | 473 | .compact li p { 474 | margin: 0em; 475 | padding: 0em; 476 | } 477 | 478 | .noborder img { 479 | border: 0; 480 | } 481 | 482 | .SVerbatim { 483 | white-space: nowrap; 484 | } 485 | 486 | .SAuthorListBox { 487 | position: relative; 488 | float: right; 489 | left: 2em; 490 | top: -2.5em; 491 | height: 0em; 492 | width: 13em; 493 | margin: 0em -13em 0em 0em; 494 | } 495 | .SAuthorList { 496 | font-size: 82%; 497 | } 498 | .SAuthorList:before { 499 | content: "by "; 500 | } 501 | .author { 502 | display: inline; 503 | white-space: nowrap; 504 | } 505 | 506 | /* print styles : hide the navigation elements */ 507 | @media print { 508 | .tocset, 509 | .navsettop, 510 | .navsetbottom { display: none; } 511 | .maincolumn { 512 | width: auto; 513 | margin-right: 13em; 514 | margin-left: 0; 515 | } 516 | } 517 | -------------------------------------------------------------------------------- /eval.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (require "expr.rkt" 6 | "val.rkt") 7 | 8 | (: inst (-> Clos Val Val)) 9 | (define (inst cl v) 10 | (match cl 11 | [(cls p e rho) 12 | (evaluate e (tupvar rho p v))] 13 | [(cmp f c) 14 | (inst f (vcon c v))] 15 | [(cval v) 16 | v])) 17 | 18 | (: app (-> Val Val Val)) 19 | (define (app u v) 20 | (match* (u v) 21 | [((vlam f) v) 22 | (inst f v)] 23 | [((vfun (sclos es rho)) (vcon c v)) 24 | (let [(res : (Option Expr) 25 | (hash-ref es c (lambda () #f)))] 26 | (if res 27 | (app (evaluate res rho) v) 28 | (error (format "error in app\n\n\t~a\n\n\t~a" 29 | u v))))] 30 | [((vfun s) (vnt k)) 31 | (vnt (ntfun s k))])) 32 | 33 | (: vfst (-> Val Val)) 34 | (define (vfst v) 35 | (match v 36 | [(vpair u _) 37 | u] 38 | [(vnt k) 39 | (vnt (ntfst k))] 40 | [_ (error (format "error in vfst:\n\n\t~a" 41 | v))])) 42 | 43 | (: vsnd (-> Val Val)) 44 | (define (vsnd v) 45 | (match v 46 | [(vpair _ u) 47 | u] 48 | [(vnt k) 49 | (vnt (ntsnd k))] 50 | [_ (error (format "error in vsnd:\n\n\t~a" 51 | v))])) 52 | 53 | (: get-rho (-> Telescope String Val)) 54 | (define (get-rho rho x) 55 | (match rho 56 | [(tupvar rho* p v) 57 | (if (in-pat? x p) 58 | (pat-proj p x v) 59 | (get-rho rho* x))] 60 | [(tupdec rho* (ddec p _ e)) 61 | (if (in-pat? x p) 62 | (pat-proj p x (evaluate e rho*)) 63 | (get-rho rho* x))])) 64 | 65 | (: pat-proj (-> Patt String Val Val)) 66 | (define (pat-proj p x v) 67 | (match p 68 | [(pvar y) #:when (equal? x y) 69 | v] 70 | [(ppair p1 _) #:when (in-pat? x p1) 71 | (pat-proj p1 x (vfst v))] 72 | [(ppair _ p2) #:when (in-pat? x p2) 73 | (pat-proj p2 x (vsnd v))] 74 | [_ (error (format "error in pat-proj:\n\n\t~a\n\n\t~a\n\n\t~v" 75 | p x v))])) 76 | 77 | (: in-pat? (-> String Patt Boolean)) 78 | (define (in-pat? x p) 79 | (match p 80 | [(pvar y) 81 | (equal? x y)] 82 | [(ppair p1 p2) 83 | (or (in-pat? x p1) 84 | (in-pat? x p2))] 85 | [_ #f])) 86 | 87 | (: evaluate (-> Expr Telescope Val)) 88 | (define (evaluate e r) 89 | (match e 90 | [(evar x) 91 | (get-rho r x)] 92 | [(eset) 93 | (vset)] 94 | [(edecl d e) 95 | (evaluate e (tupdec r d))] 96 | [(elam p e) 97 | (vlam (cls p e r))] 98 | [(epi p a b) 99 | (vpi (evaluate a r) (cls p b r))] 100 | [(esigma p a b) 101 | (vsigma (evaluate a r) (cls p b r))] 102 | [(eone) 103 | (vone)] 104 | [(eunit) 105 | (vunit)] 106 | [(efst e) 107 | (vfst (evaluate e r))] 108 | [(esnd e) 109 | (vsnd (evaluate e r))] 110 | [(eapp rator rand) 111 | (app (evaluate rator r) (evaluate rand r))] 112 | [(etuple e1 e2) 113 | (vpair (evaluate e1 r) (evaluate e2 r))] 114 | [(econ c e1) 115 | (vcon c (evaluate e1 r))] 116 | [(esum cas) 117 | (vsum (sclos cas r))] 118 | [(efun ces) 119 | (vfun (sclos ces r))])) 120 | 121 | -------------------------------------------------------------------------------- /examples/function.rkttt: -------------------------------------------------------------------------------- 1 | ;; a one and two type, intuitively 2 | (let (: two set) ; `bool` 3 | (sum ['t 'f])) 4 | (let (: one set) ; `unit` 5 | (sum ['tt])) 6 | 7 | (let (: rt (-> two set)) ; a dependent function 8 | (fun [(=> 't unit) 9 | (=> 'f one)])) 10 | 11 | (let (: func (pi (: b two) (rt b))) ; return differnt things :3 12 | (fun [(=> 't 0) 13 | (=> 'f 'tt)])) 14 | -------------------------------------------------------------------------------- /examples/girard.rkttt: -------------------------------------------------------------------------------- 1 | (let (: girard set) 2 | set) 3 | -------------------------------------------------------------------------------- /examples/io.rkttt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanleyc01/rkttt/02f98cb929f2bbc6a31749fe77a0be3c9c6630ab/examples/io.rkttt -------------------------------------------------------------------------------- /examples/nat.rkttt: -------------------------------------------------------------------------------- 1 | (let (: bool set) 2 | (sum ['true 'false])) 3 | 4 | (letrec (: nat set) 5 | (sum ['zero 6 | ('suc nat)])) 7 | 8 | (letrec (: is-even (-> nat bool)) 9 | (lambda x 10 | (fun [(=> 'zero 't) 11 | (=> ('suc n) 'f)]))) 12 | -------------------------------------------------------------------------------- /examples/test.rkttt: -------------------------------------------------------------------------------- 1 | (let (: bool set) 2 | (sum ['t 'f])) 3 | 4 | (let (: edwin set) 5 | (sum [('fart bool)])) 6 | 7 | (let (: destr (pi (: _ edwin) bool)) 8 | (fun [(=> ('fart x) 9 | (fun [('t 't) 10 | ('f 'f)]))])) 11 | -------------------------------------------------------------------------------- /expr.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket/shallow 2 | 3 | (provide (all-defined-out)) 4 | 5 | (define-type Expr 6 | (U elam eset epi esigma eone eunit 7 | econ esum efun efst esnd eapp 8 | evar evoid edecl etuple)) 9 | 10 | (struct elam 11 | ([patt : Patt] 12 | [body : Expr]) 13 | #:transparent) 14 | 15 | (struct eset 16 | () #:transparent) 17 | 18 | (struct etuple 19 | ([lhs : Expr] 20 | [rhs : Expr]) #:transparent) 21 | 22 | (struct epi 23 | ([pat : Patt] 24 | [type : Expr] 25 | [body : Expr]) #:transparent) 26 | 27 | (struct esigma 28 | ([pat : Patt] 29 | [type : Expr] 30 | [body : Expr]) #:transparent) 31 | 32 | (struct eone () #:transparent) 33 | 34 | (struct eunit () #:transparent) 35 | 36 | (struct econ 37 | ([name : Symbol] 38 | [body : Expr]) #:transparent) 39 | 40 | (struct esum 41 | ([branch : Branch]) #:transparent) 42 | 43 | (struct efun 44 | ([branch : Branch]) #:transparent) 45 | 46 | (struct efst 47 | ([exp : Expr]) #:transparent) 48 | 49 | (struct esnd 50 | ([exp : Expr]) #:transparent) 51 | 52 | (struct eapp 53 | ([rator : Expr] 54 | [rand : Expr]) #:transparent) 55 | 56 | (struct evar 57 | ([name : String]) #:transparent) 58 | 59 | (struct evoid () #:transparent) 60 | 61 | (struct edecl 62 | ([decl : Decl] 63 | [body : Expr]) #:transparent) 64 | 65 | (struct ddec 66 | ([patt : Patt] 67 | [type : Expr] 68 | [body : Expr]) #:transparent) 69 | 70 | (struct drec 71 | ([patt : Patt] 72 | [type : Expr] 73 | [body : Expr]) #:transparent) 74 | 75 | (define-type Decl (U ddec drec)) 76 | 77 | (struct ppair 78 | ([lhs : Patt] 79 | [rhs : Patt]) #:transparent) 80 | 81 | (struct pvar 82 | ([name : String]) #:transparent) 83 | 84 | (struct pwild 85 | () #:transparent) 86 | 87 | (define-type Patt (U pvar ppair pwild)) 88 | 89 | (define-type Branch (Immutable-HashTable Symbol Expr)) 90 | -------------------------------------------------------------------------------- /lexing.rkt: -------------------------------------------------------------------------------- 1 | #lang racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (require parser-tools/yacc 6 | parser-tools/lex 7 | (prefix-in : parser-tools/lex-sre)) 8 | 9 | ;; token definitions 10 | (define-empty-tokens 11 | empty-tokens 12 | (EOF COMMENT WHITESPACE LPAREN RPAREN LBRACK RBRACK LAMBDA SET 13 | DOT SIGMA PI ONE UNIT FUN SUM VOID LET LETREC WILD COLON COMMA 14 | CONS CAR CDR ARROW FATARROW STAR)) 15 | 16 | (define-tokens 17 | literal-tokens 18 | (IDENT LABEL ERROR TOKEN-ERROR)) 19 | 20 | 21 | (define rktttl 22 | (lexer-src-pos [(eof) (token-EOF)] 23 | [(:or #\tab #\space #\return #\newline) (token-WHITESPACE)] 24 | [(:: ";" (:* (char-complement #\newline))) (token-COMMENT)] 25 | [(:: "#|" (:* (complement "|#") "|#")) (token-COMMENT)] 26 | ["(" (token-LPAREN)] 27 | [")" (token-RPAREN)] 28 | ["[" (token-LBRACK)] 29 | ["]" (token-RBRACK)] 30 | ["lambda" (token-LAMBDA)] 31 | ["set" (token-SET)] 32 | ["sigma" (token-SIGMA)] 33 | ["pi" (token-PI)] 34 | ["unit" (token-UNIT)] 35 | ["0" (token-ONE)] 36 | ["fun" (token-FUN)] 37 | ["sum" (token-SUM)] 38 | ["void" (token-VOID)] 39 | ["let" (token-LET)] 40 | ["letrec" (token-LETREC)] 41 | ["cons" (token-CONS)] 42 | ["car" (token-CAR)] 43 | ["cdr" (token-CDR)] 44 | ["*" (token-STAR)] 45 | ["->" (token-ARROW)] 46 | ["=>" (token-FATARROW)] 47 | ["," (token-COMMA)] 48 | [":" (token-COLON)] 49 | ["_" (token-WILD)] 50 | ["." (token-DOT)] 51 | [(:: (:or (:/ "a" "z") (:/ #\A #\Z) #\_ #\- #\*) 52 | (:* (:or (:/ "a" "z") (:/ #\A #\Z) #\_) #\- #\* (:/ "0" "9"))) 53 | (token-IDENT lexeme)] 54 | [(:: "'" (:or (:/ "a" "z") (:/ #\A #\Z) #\_ #\- #\*) 55 | (:* (:or (:/ "a" "z") (:/ #\A #\Z) #\_) #\- #\* (:/ "0" "9"))) 56 | (token-LABEL (string->symbol lexeme))])) 57 | 58 | 59 | (define (lex lexbuf) 60 | (begin 61 | (define (accum acc) 62 | (let ([res (rktttl lexbuf)]) 63 | (if (equal? (position-token-token res) 'EOF) 64 | (reverse (cons res acc)) 65 | (accum (cons res acc))))) 66 | (accum empty))) 67 | 68 | (define (get-token in) 69 | (let ([res (rktttl in)]) 70 | (if (or (equal? 'COMMENT (position-token-token res)) 71 | (equal? 'WHITESPACE (position-token-token res))) 72 | (get-token in) 73 | res))) 74 | -------------------------------------------------------------------------------- /nanopass-experiment/expr.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (define-type Expr 6 | (U elam eset epi esigma eone eunit 7 | econ esum efun efst esnd eapp 8 | evar evoid edecl etuple)) 9 | 10 | (struct elam 11 | ([patt : Patt] 12 | [body : Expr]) 13 | #:transparent) 14 | 15 | (struct eset 16 | () #:transparent) 17 | 18 | (struct etuple 19 | ([lhs : Expr] 20 | [rhs : Expr]) #:transparent) 21 | 22 | (struct epi 23 | ([pat : Patt] 24 | [type : Expr] 25 | [body : Expr]) #:transparent) 26 | 27 | (struct esigma 28 | ([pat : Patt] 29 | [type : Expr] 30 | [body : Expr]) #:transparent) 31 | 32 | (struct eone () #:transparent) 33 | 34 | (struct eunit () #:transparent) 35 | 36 | (struct econ 37 | ([name : Symbol] 38 | [body : Expr]) #:transparent) 39 | 40 | (struct esum 41 | ([branch : Branch]) #:transparent) 42 | 43 | (struct efun 44 | ([branch : Branch]) #:transparent) 45 | 46 | (struct efst 47 | ([exp : Expr]) #:transparent) 48 | 49 | (struct esnd 50 | ([exp : Expr]) #:transparent) 51 | 52 | (struct eapp 53 | ([rator : Expr] 54 | [rand : Expr]) #:transparent) 55 | 56 | (struct evar 57 | ([name : String]) #:transparent) 58 | 59 | (struct evoid () #:transparent) 60 | 61 | (struct edecl 62 | ([decl : Decl] 63 | [body : Expr]) #:transparent) 64 | 65 | (struct ddec 66 | ([patt : Patt] 67 | [type : Expr] 68 | [body : Expr]) #:transparent) 69 | 70 | (struct drec 71 | ([patt : Patt] 72 | [type : Expr] 73 | [body : Expr]) #:transparent) 74 | 75 | (define-type Decl (U ddec drec)) 76 | 77 | (struct ppair 78 | ([lhs : Patt] 79 | [rhs : Patt]) #:transparent) 80 | 81 | (struct pvar 82 | ([name : String]) #:transparent) 83 | 84 | (struct pwild 85 | () #:transparent) 86 | 87 | (define-type Patt (U pvar ppair pwild)) 88 | 89 | (define-type Branch (Immutable-HashTable Symbol Expr)) 90 | 91 | -------------------------------------------------------------------------------- /nanopass-experiment/nexpr.rkt: -------------------------------------------------------------------------------- 1 | #lang nanopass 2 | 3 | (define variable? 4 | (lambda (x) 5 | (string? x))) 6 | 7 | (define label? 8 | (lambda (l) 9 | (symbol? l))) 10 | 11 | (define eprim? 12 | (lambda (e) 13 | (memq e '(0 set void unit)))) 14 | 15 | (define wild? 16 | (lambda (w) 17 | (equal? w '_))) 18 | 19 | (define (arrow? a) 20 | (equal? a '=>)) 21 | 22 | (define (small-arrow? a) 23 | (equal? a '->)) 24 | 25 | (define-language L0 26 | [entry Decls] 27 | [terminals 28 | (variable (x)) 29 | (label (l)) 30 | (eprim (pr)) 31 | (arrow (a)) 32 | (small-arrow (s)) 33 | (wild (w))] 34 | [Patt (p) 35 | x 36 | w 37 | (values p1 p)] 38 | [Tvar (tvar) 39 | (: p e)] 40 | [Branch (b) 41 | l 42 | (l e) 43 | (a (l p) e) 44 | (a l e)] 45 | [Expr (e) 46 | (e1 e2) 47 | (lambda p e) 48 | x 49 | pr 50 | 'l 51 | (* e1 e2) 52 | (s e1 e2) 53 | (pi tvar e2) 54 | (sigma tvar e2) 55 | (fun [b* ... b]) 56 | (sum [b* ... b]) 57 | w] 58 | [Decl (d) 59 | (let tvar e*) 60 | (letrec tvar e*)] 61 | [Decls (ds) 62 | (d ds) 63 | d]) 64 | 65 | (define-parser pl0 L0) 66 | 67 | #| 68 | (pl0 `((let (: ,"fart" set) set) 69 | (let (: ,"foo" unit) 0))) 70 | 71 | (pl0 `(let (: ,"fart" set) 72 | (sum [,'foo 73 | (=> (,'fart _) set) 74 | (=> ,'fart set)]))) 75 | |# 76 | 77 | (define-language L1 78 | (extends L0) 79 | (Expr (e) 80 | (- (s e1 e2) 81 | (* e1 e2)))) 82 | 83 | (define-pass pass0 : L0 (ir) -> L1 () 84 | (Expr : Expr (ir) -> Expr () 85 | [(,s ,e1 ,e2) 86 | `(pi (: _ ,e1) ,e2)] 87 | [(* ,e1 ,e2) 88 | `(sigma (: _ ,e1) ,e2)]) 89 | (Expr ir) 90 | (Decl : Decl (ir) -> Decl () 91 | [(,let ,p ,e) 92 | `(let ,p ,e)] 93 | [(,letrec ,p ,e) 94 | `(letrec ,p ,e)])) 95 | 96 | (define testin 97 | '(let (: "f" (-> set set)) 98 | (lambda "a" 99 | set))) 100 | 101 | (define (test p) 102 | (begin 103 | (define parse-res (pl0 p)) 104 | (pretty-display parse-res) 105 | (define pass-res (pass0 parse-res)) 106 | (pretty-display pass-res))) 107 | 108 | (test testin) 109 | -------------------------------------------------------------------------------- /normal.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (require "expr.rkt") 6 | 7 | (define-type Nm (U nmlam nmpair nmcon nmunit 8 | nmset nmone nmpi nmsigma nmfun 9 | nmsum nmneut)) 10 | 11 | (struct nmlam 12 | ([n : Integer] 13 | [body : Nm]) #:transparent) 14 | 15 | (struct nmpair 16 | ([lhs : Nm] 17 | [rhs : Nm]) #:transparent) 18 | 19 | (struct nmcon 20 | ([name : Symbol] 21 | [body : Nm]) #:transparent) 22 | 23 | (struct nmunit 24 | () #:transparent) 25 | 26 | (struct nmset 27 | () #:transparent) 28 | 29 | (struct nmone 30 | () #:transparent) 31 | 32 | (struct nmpi 33 | ([type : Nm] 34 | [n : Integer] 35 | [body : Nm]) #:transparent) 36 | 37 | (struct nmsigma 38 | ([type : Nm] 39 | [n : Integer] 40 | [body : Nm]) #:transparent) 41 | 42 | (struct nmfun 43 | ([clos : NmClos]) #:transparent) 44 | 45 | (struct nmsum 46 | ([clos : NmClos]) #:transparent) 47 | 48 | (struct nmneut 49 | ([nt : NmNt]) #:transparent) 50 | 51 | (define-type NmNt (U nmntgen 52 | nmntapp 53 | nmntfst 54 | nmntsnd 55 | nmntfun)) 56 | 57 | (struct nmntgen 58 | ([n : Integer])) 59 | 60 | (struct nmntapp 61 | ([rator : NmNt] 62 | [rand : Nm]) #:transparent) 63 | 64 | (struct nmntfst 65 | ([exp : NmNt]) #:transparent) 66 | 67 | (struct nmntsnd 68 | ([exp : NmNt]) #:transparent) 69 | 70 | (struct nmntfun 71 | ([clos : NmClos] 72 | [neut : NmNt]) #:transparent) 73 | 74 | (define-type NmTelescope (U nmtupvar nmtupdec nmtnil)) 75 | 76 | (struct nmtnil () #:transparent) 77 | 78 | (struct nmtupvar 79 | ([rho : NmTelescope] 80 | [patt : Patt] 81 | [nm : Nm]) #:transparent) 82 | 83 | (struct nmtupdec 84 | ([rho : NmTelescope] 85 | [decl : Decl])) 86 | 87 | (define-type NmClos (Pairof Branch NmTelescope)) 88 | -------------------------------------------------------------------------------- /parsing.rkt: -------------------------------------------------------------------------------- 1 | #lang racket 2 | 3 | (provide parse) 4 | 5 | (require parser-tools/yacc 6 | "lexing.rkt" 7 | "expr.rkt") 8 | 9 | (define rktttp 10 | (parser 11 | [start decls] 12 | [end EOF] 13 | [error 14 | (lambda (tok-ok? tok-name tok-value start-pos end-pos) 15 | (begin 16 | (printf 17 | "tok-ok? = ~a\ntok-name = ~a\ntok-value = ~a\nstart-pos = ~a\nend-pos = ~a\n" 18 | tok-ok? 19 | tok-name 20 | tok-value 21 | start-pos 22 | end-pos) 23 | (void)))] 24 | [tokens empty-tokens literal-tokens] 25 | [src-pos] 26 | [yacc-output "debug/debug.y"] 27 | [debug "debug/debug.lalr"] 28 | [grammar 29 | [decls 30 | [() empty] 31 | [(decl) (list $1)] 32 | [(decl decls) (cons $1 $2)]] 33 | [decl 34 | [(LPAREN LET tvar expr RPAREN) 35 | (ddec (car $3) (cdr $3) $4)] 36 | [(LPAREN LETREC tvar expr RPAREN) 37 | (drec (car $3) (cdr $3) $4)]] 38 | [tvar 39 | [(LPAREN COLON patt expr RPAREN) 40 | (cons $3 $4)]] 41 | [patt 42 | [(WILD) 43 | (pwild)] 44 | [(IDENT) 45 | (pvar $1)] 46 | [(LPAREN COMMA patt patt RPAREN) 47 | (ppair $3 $4)]] 48 | [expr 49 | [(IDENT) 50 | (evar $1)] 51 | [(LABEL) 52 | (econ $1 (eone))] 53 | [(LPAREN LABEL expr RPAREN) 54 | (econ $2 $3)] 55 | [(LPAREN expr expr RPAREN) 56 | (eapp $2 $3)] 57 | [(LPAREN CONS expr expr RPAREN) 58 | (etuple $3 $4)] 59 | [(LPAREN LAMBDA patt expr RPAREN) 60 | (elam $3 $4)] 61 | [(LPAREN PI tvar expr RPAREN) 62 | (epi (car $3) (cdr $3) $4)] 63 | [(LPAREN SIGMA tvar expr RPAREN) 64 | (esigma (car $3) (cdr $3) $4)] 65 | [(LPAREN ARROW expr expr RPAREN) 66 | (epi (pwild) $3 $4)] 67 | [(LPAREN STAR expr expr RPAREN) 68 | (esigma (pwild) $3 $4)] 69 | [(SET) 70 | (eset)] 71 | [(UNIT) 72 | (eunit)] 73 | [(ONE) 74 | (eone)] 75 | [(LPAREN LABEL expr RPAREN) 76 | (econ $2 $3)] 77 | [(LPAREN SUM LBRACK branches RBRACK RPAREN) 78 | (esum (make-immutable-hash $4))] 79 | [(LPAREN FUN LBRACK branches RBRACK RPAREN) 80 | (efun (make-immutable-hash $4))] 81 | [(LPAREN CAR expr RPAREN) 82 | (efst $3)] 83 | [(LPAREN CDR expr RPAREN) 84 | (esnd $3)] 85 | [(VOID) 86 | (evoid)]] 87 | [branch 88 | [(LABEL) 89 | (cons $1 (eunit))] 90 | [(LPAREN LABEL expr RPAREN) 91 | (cons $2 $3)] 92 | [(LPAREN FATARROW LABEL expr RPAREN) 93 | (cons $3 (elam (pwild) $4))] 94 | [(LPAREN FATARROW LPAREN LABEL patt RPAREN expr RPAREN) 95 | (cons $4 (elam $5 $7))]] 96 | [branches 97 | [() empty] 98 | [(branch) (list $1)] 99 | [(branch branches) (cons $1 $2)]]])) 100 | 101 | (define (parse inp) 102 | (rktttp (lambda () (get-token inp)))) 103 | -------------------------------------------------------------------------------- /readback.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (require "val.rkt" 6 | "normal.rkt" 7 | "eval.rkt") 8 | 9 | (: gen-v (-> Integer Val)) 10 | (define (gen-v k) 11 | (vnt (ntgen k))) 12 | 13 | (: read-back-val (-> Integer Val Nm)) 14 | (define (read-back-val k v*) 15 | (match v* 16 | [(vlam f) 17 | (nmlam k (read-back-val (add1 k) (inst f (gen-v k))))] 18 | [(vpair u v) 19 | (nmpair (read-back-val k u) (read-back-val k v))] 20 | [(vcon c v) 21 | (nmcon c (read-back-val k v))] 22 | [(vunit) 23 | (nmunit)] 24 | [(vset) 25 | (nmset)] 26 | [(vpi t g) 27 | (nmpi (read-back-val k t) 28 | k 29 | (read-back-val (add1 k) 30 | (inst g (gen-v k))))] 31 | [(vsigma t g) 32 | (nmsigma (read-back-val k t) 33 | k 34 | (read-back-val (add1 k) 35 | (inst g (gen-v k))))] 36 | [(vone) 37 | (nmone)] 38 | [(vfun (sclos s rho)) 39 | (nmfun (cons s (read-back-tele k rho)))] 40 | [(vsum (sclos s rho)) 41 | (nmsum (cons s (read-back-tele k rho)))] 42 | [(vnt l) 43 | (nmneut (read-back-neut k l))])) 44 | 45 | (: read-back-tele (-> Integer Telescope NmTelescope)) 46 | (define (read-back-tele k rho) 47 | (match rho 48 | [(tnil) 49 | (nmtnil)] 50 | [(tupvar rho* p v) 51 | (nmtupvar (read-back-tele k rho*) 52 | p 53 | (read-back-val k v))] 54 | [(tupdec rho* d) 55 | (nmtupdec (read-back-tele k rho*) 56 | d)])) 57 | 58 | (: read-back-neut (-> Integer Neut NmNt)) 59 | (define (read-back-neut k n) 60 | (match n 61 | [(ntgen j) 62 | (nmntgen j)] 63 | [(ntapp rator rand) 64 | (nmntapp (read-back-neut k rator) 65 | (read-back-val k rand))] 66 | [(ntfst m) 67 | (nmntfst (read-back-neut k m))] 68 | [(ntsnd m) 69 | (nmntsnd (read-back-neut k m))] 70 | [(ntfun (cons s rho) m) 71 | (nmntfun (cons s (read-back-tele k rho)) 72 | (read-back-neut k m))])) 73 | -------------------------------------------------------------------------------- /rkttt.rkt: -------------------------------------------------------------------------------- 1 | #lang racket 2 | 3 | (require "parsing.rkt" 4 | "expr.rkt" 5 | "val.rkt" 6 | "tc.rkt") 7 | 8 | (define fart 1) 9 | 10 | (define (arrange xs) 11 | (foldr (lambda (x y) (edecl x y)) (eone) xs)) 12 | 13 | (define (typecheck in-file) 14 | (if (empty? in-file) 15 | (displayln "USAGE: please provide filepath to compile :3") 16 | (letrec ([inc (open-input-file in-file)] 17 | [res (parse inc)] 18 | [arranged (arrange res)]) 19 | (begin 20 | (when debug-mode 21 | (pretty-display res)) 22 | (check-main debug-mode arranged (vunit)) 23 | (displayln "typecheck complete!"))))) 24 | 25 | 26 | (define debug-mode #f) 27 | 28 | (define rkttt 29 | (command-line 30 | #:usage-help 31 | "USAGE: welcome to rkttt, this is an implementation of mini-tt in racket" 32 | ":3 apologies if it is slow, typed racket is slow, and there's definitely" 33 | "some optimizations to be done!" 34 | #:once-each 35 | [("-t" "--typecheck") PATH "path to file" (typecheck PATH)] 36 | [("-d" "--debug") "Display debug information" (set! debug-mode #t)] 37 | #:args () 38 | (void))) 39 | -------------------------------------------------------------------------------- /tc.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket/shallow 2 | 3 | (provide check-main) 4 | 5 | (require "val.rkt" 6 | "eval.rkt" 7 | "expr.rkt" 8 | "readback.rkt") 9 | 10 | (define-type Gamma (Immutable-HashTable String Val)) 11 | 12 | (: *debug-mode* (Boxof Boolean)) 13 | (define *debug-mode* (box #f)) 14 | 15 | (: up-g (-> Gamma Patt Val Val Gamma)) 16 | (define (up-g gamma p t v) 17 | (when (unbox *debug-mode*) 18 | (displayln (format "up-g with:\n\t~a\n\t~a\n\t~a:\n\t~a" 19 | gamma p t v))) 20 | (match* (p t) 21 | [((pwild) _) 22 | gamma] 23 | [((pvar x) t) 24 | (hash-set gamma x t)] 25 | [((ppair p1 p2) (vsigma t g)) 26 | (let ([gamma* (up-g gamma p1 t (vfst v))]) 27 | (up-g gamma* p2 (inst g (vfst v)) (vsnd v)))])) 28 | 29 | (: check-type (-> Integer Telescope Gamma Expr Void)) 30 | (define (check-type k rho gamma e) 31 | (when (unbox *debug-mode*) 32 | (displayln (format "check-type with:\n\t~a\n\t~a\n\t~a\n\t~a" k rho gamma e))) 33 | (match e 34 | [(epi p a b) 35 | (begin (check-type k rho gamma a) 36 | (define gamma* (up-g gamma p (evaluate a rho) (gen-v k))) 37 | (check-type (add1 k) (tupvar rho p (gen-v k)) gamma* b))] 38 | [(esigma p a b) 39 | (begin (check-type k rho gamma a) 40 | (define gamma* (up-g gamma p (evaluate a rho) (gen-v k))) 41 | (check-type (add1 k) (tupvar rho p (gen-v k)) gamma* b))] 42 | [(eset) (void)] 43 | [(eunit) (void)] 44 | [(evoid) (void)] 45 | [_ (check k rho gamma e (vset))])) 46 | 47 | (: check (-> Integer Telescope Gamma Expr Val Void)) 48 | (define (check k rho gamma e* t*) 49 | (when (unbox *debug-mode*) 50 | (displayln (format "check with:\n\t~a\n\t~a\n\t~a\n\t~a\n\t~a" 51 | k rho gamma e* t*))) 52 | (match* (e* t*) 53 | [((elam p e) (vpi t g)) 54 | (define gen (gen-v k)) 55 | (define gamma* (up-g gamma p t gen)) 56 | (check (add1 k) (tupvar rho p gen) gamma* e (inst g gen))] 57 | [((etuple e1 e2) (vsigma t g)) 58 | (check k rho gamma e1 t) 59 | (check k rho gamma e2 (inst g (evaluate e1 rho)))] 60 | [((econ c e) (vsum (sclos cas rho*))) 61 | (define a : (Option Expr) 62 | (hash-ref cas c (lambda () #f))) 63 | (when a 64 | (check k rho gamma e (evaluate a rho*)))] 65 | [((efun ces) (vpi (vsum (sclos cas rho*)) g)) 66 | (define ces* (hash-keys ces)) 67 | (define cas* (hash-keys cas)) 68 | (if (equal? ces* cas*) 69 | (for* ([x (hash->list ces)] 70 | [y (hash->list cas)]) 71 | (match* (x y) 72 | [((cons c e) (cons _ a)) 73 | (check k rho gamma e 74 | (vpi (evaluate a rho*) 75 | (cmp g c)))])) 76 | (error (format "branches do not match:\n\n\t~a\n\n\t~a" 77 | cas ces)))] 78 | [((eunit) (vset)) 79 | (void)] 80 | [((eone) (vunit)) 81 | (void)] 82 | [((epi p a b) (vset)) 83 | (check k rho gamma a (vset)) 84 | (define gen (gen-v k)) 85 | (define gamma* (up-g gamma p (evaluate a rho) gen)) 86 | (check (add1 k) (tupvar rho p gen) gamma* b (vset))] 87 | [((esigma p a b) (vset)) 88 | (check k rho gamma (epi p a b) (vset))] 89 | [((esum cas) (vset)) 90 | (for ([a (hash-values cas)]) 91 | (check k rho gamma a (vset)))] 92 | [((edecl d e) t) 93 | (define gamma* (check-decl k rho gamma d)) 94 | (check k (tupdec rho d) gamma* e t)] 95 | [(_ _) 96 | (define t** (check-infer k rho gamma e*)) 97 | (when (equal-nf? k t* t**) 98 | (void))])) 99 | 100 | (: check-infer (-> Integer Telescope Gamma Expr Val)) 101 | (define (check-infer k rho gamma e*) 102 | (when (unbox *debug-mode*) 103 | (displayln (format "check-infer with:~a\n\t~a\n\t~a\n\t~a" 104 | k rho gamma e*))) 105 | (match e* 106 | [(eset) (vset)] 107 | [(eunit) (vset)] 108 | [(eone) (vunit)] 109 | [(evoid) (vset)] 110 | [(evar x) 111 | (let ([res : (Option Val) (hash-ref gamma x #f)]) 112 | (if res 113 | res 114 | (error (format "check-infer error with gamma:\n\n\t~a\n\nand expr:\n\n\t~a" 115 | gamma e*))))] 116 | [(eapp rator rand) 117 | (define t* (check-infer k rho gamma rator)) 118 | (letrec ([x (ext-pi t*)] 119 | [t (car x)] 120 | [g (cdr x)]) 121 | (begin (check k rho gamma rand t) 122 | (inst g (evaluate rand rho))))] 123 | [(etuple lhs rhs) 124 | (define lft (check-infer k rho gamma lhs)) 125 | (define rht (check-infer k rho gamma rhs)) 126 | (vsigma lft (cval rht))] 127 | [(efst e) 128 | (define t (check-infer k rho gamma e)) 129 | (letrec ([x (ext-sigma t)] 130 | [a (car x)]) 131 | a)] 132 | [(esnd e) 133 | (define t (check-infer k rho gamma e)) 134 | (letrec ([x (ext-sigma t)] 135 | [g (cdr x)]) 136 | (inst g (vfst (evaluate e rho))))] 137 | [_ (error 138 | (format 139 | (string-append 140 | "unable to infer an expression which is not one of the following:" 141 | "\n\ta projection (car/cdr )\n\ta tuple (cons )" 142 | "\n\tan application ( )" 143 | "\n\ta variable, 0, unit, or set" 144 | "\n\nthe expression given was of type:\n\t~a") 145 | e*))])) 146 | 147 | (: ext-pi (-> Val (Pairof Val Clos))) 148 | (define (ext-pi t) 149 | (match t 150 | [(vpi t* g) 151 | (cons t* g)] 152 | [_ (error (format "error in ext-pi with:\n\n\t~a" 153 | t))])) 154 | 155 | (: ext-sigma (-> Val (Pairof Val Clos))) 156 | (define (ext-sigma t) 157 | (match t 158 | [(vsigma t* g) 159 | (cons t* g)] 160 | [_ (error (format "error in ext-sigma with:\n\n\t~a" 161 | t))])) 162 | 163 | (: check-decl (-> Integer Telescope Gamma Decl Gamma)) 164 | (define (check-decl k rho gamma d) 165 | (when (unbox *debug-mode*) 166 | (displayln (format "check-decl with:\n\t~a\n\t~a\n\t~a\n\t~a" 167 | k rho gamma d))) 168 | (match d 169 | [(ddec p a e) 170 | (begin (check-type k rho gamma a) 171 | (define t (evaluate a rho)) 172 | (check k rho gamma e t) 173 | (up-g gamma p t (evaluate e rho)))] 174 | [(drec p a e) 175 | (begin (check-type k rho gamma a) 176 | (define t (evaluate a rho)) 177 | (define gen (gen-v k)) 178 | (define gamma* (up-g gamma p t gen)) 179 | (pretty-display gamma*) 180 | (check (add1 k) (tupvar rho p gen) gamma* e t) 181 | (define v (evaluate e (tupdec rho d))) 182 | (up-g gamma p t v))])) 183 | 184 | (: equal-nf? (-> Integer Val Val Boolean)) 185 | (define (equal-nf? k m n) 186 | (when (unbox *debug-mode*) 187 | (displayln (format "equal-nf? with ~a ~a ~a" 188 | k m n))) 189 | (begin (define e (read-back-val k m)) 190 | (define g (read-back-val k n)) 191 | (equal? e g))) 192 | 193 | (: check-main (-> Boolean Expr Val Void)) 194 | (define (check-main debug e t) 195 | (set-box! *debug-mode* debug) 196 | (when (unbox *debug-mode*) 197 | (displayln (format "check-main with:\n\t~a\n\t~a" e t))) 198 | (check 0 (tnil) (hash) e t)) 199 | 200 | -------------------------------------------------------------------------------- /testout: -------------------------------------------------------------------------------- 1 | (#(struct:ddec 2 | #(struct:pvar two) 3 | #(struct:eset) 4 | #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))))) 5 | #(struct:ddec 6 | #(struct:pvar one) 7 | #(struct:eset) 8 | #(struct:esum #hash(('tt . #(struct:eunit))))) 9 | #(struct:ddec 10 | #(struct:pvar rt) 11 | #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) 12 | #(struct:efun 13 | #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) 14 | ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) 15 | #(struct:ddec 16 | #(struct:pvar func) 17 | #(struct:epi 18 | #(struct:pvar b) 19 | #(struct:evar two) 20 | #(struct:eapp #(struct:evar rt) #(struct:evar b))) 21 | #(struct:efun 22 | #hash(('f 23 | . 24 | #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) 25 | ('t . #(struct:elam #(struct:pwild) #(struct:eone))))))) 26 | check-main with: 27 | #(struct:edecl #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))))) #(struct:edecl #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))) #(struct:edecl #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) #(struct:edecl #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) #(struct:eone))))) 28 | #(struct:vunit) 29 | check with: 30 | 0 31 | #(struct:tnil) 32 | #hash() 33 | #(struct:edecl #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))))) #(struct:edecl #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))) #(struct:edecl #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) #(struct:edecl #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) #(struct:eone))))) 34 | #(struct:vunit) 35 | check-decl with: 36 | 0 37 | #(struct:tnil) 38 | #hash() 39 | #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))))) 40 | check-type with: 41 | 0 42 | #(struct:tnil) 43 | #hash() 44 | #(struct:eset) 45 | check with: 46 | 0 47 | #(struct:tnil) 48 | #hash() 49 | #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))) 50 | #(struct:vset) 51 | check with: 52 | 0 53 | #(struct:tnil) 54 | #hash() 55 | #(struct:eunit) 56 | #(struct:vset) 57 | check with: 58 | 0 59 | #(struct:tnil) 60 | #hash() 61 | #(struct:eunit) 62 | #(struct:vset) 63 | up-g with: 64 | #hash() 65 | #(struct:pvar two) 66 | #(struct:vset): 67 | #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) 68 | check with: 69 | 0 70 | #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) 71 | #hash((two . #(struct:vset))) 72 | #(struct:edecl #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))) #(struct:edecl #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) #(struct:edecl #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) #(struct:eone)))) 73 | #(struct:vunit) 74 | check-decl with: 75 | 0 76 | #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) 77 | #hash((two . #(struct:vset))) 78 | #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))) 79 | check-type with: 80 | 0 81 | #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) 82 | #hash((two . #(struct:vset))) 83 | #(struct:eset) 84 | check with: 85 | 0 86 | #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) 87 | #hash((two . #(struct:vset))) 88 | #(struct:esum #hash(('tt . #(struct:eunit)))) 89 | #(struct:vset) 90 | check with: 91 | 0 92 | #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) 93 | #hash((two . #(struct:vset))) 94 | #(struct:eunit) 95 | #(struct:vset) 96 | up-g with: 97 | #hash((two . #(struct:vset))) 98 | #(struct:pvar one) 99 | #(struct:vset): 100 | #(struct:vsum #(struct:sclos #hash(('tt . #(struct:eunit))) #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))))) 101 | check with: 102 | 0 103 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 104 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 105 | #(struct:edecl #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) #(struct:edecl #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) #(struct:eone))) 106 | #(struct:vunit) 107 | check-decl with: 108 | 0 109 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 110 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 111 | #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))) 112 | check-type with: 113 | 0 114 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 115 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 116 | #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) 117 | check-type with: 118 | 0 119 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 120 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 121 | #(struct:evar two) 122 | check with: 123 | 0 124 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 125 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 126 | #(struct:evar two) 127 | #(struct:vset) 128 | check-infer with:0 129 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 130 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 131 | #(struct:evar two) 132 | equal-nf? with 0 #(struct:vset) #(struct:vset) 133 | up-g with: 134 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 135 | #(struct:pwild) 136 | #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))): 137 | #(struct:vnt #(struct:ntgen 0)) 138 | check-type with: 139 | 1 140 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 141 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 142 | #(struct:eset) 143 | check with: 144 | 0 145 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 146 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 147 | #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))) 148 | #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))))) 149 | check with: 150 | 0 151 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 152 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 153 | #(struct:elam #(struct:pwild) #(struct:eunit)) 154 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))) 't)) 155 | up-g with: 156 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 157 | #(struct:pwild) 158 | #(struct:vunit): 159 | #(struct:vnt #(struct:ntgen 0)) 160 | check with: 161 | 1 162 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 163 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 164 | #(struct:eunit) 165 | #(struct:vset) 166 | check with: 167 | 0 168 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 169 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 170 | #(struct:elam #(struct:pwild) #(struct:eunit)) 171 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))) 't)) 172 | up-g with: 173 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 174 | #(struct:pwild) 175 | #(struct:vunit): 176 | #(struct:vnt #(struct:ntgen 0)) 177 | check with: 178 | 1 179 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 180 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 181 | #(struct:eunit) 182 | #(struct:vset) 183 | check with: 184 | 0 185 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 186 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 187 | #(struct:elam #(struct:pwild) #(struct:evar one)) 188 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))) 'f)) 189 | up-g with: 190 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 191 | #(struct:pwild) 192 | #(struct:vunit): 193 | #(struct:vnt #(struct:ntgen 0)) 194 | check with: 195 | 1 196 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 197 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 198 | #(struct:evar one) 199 | #(struct:vset) 200 | check-infer with:1 201 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 202 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 203 | #(struct:evar one) 204 | equal-nf? with 1 #(struct:vset) #(struct:vset) 205 | check with: 206 | 0 207 | #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) 208 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 209 | #(struct:elam #(struct:pwild) #(struct:evar one)) 210 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))) 'f)) 211 | up-g with: 212 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 213 | #(struct:pwild) 214 | #(struct:vunit): 215 | #(struct:vnt #(struct:ntgen 0)) 216 | check with: 217 | 1 218 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 219 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 220 | #(struct:evar one) 221 | #(struct:vset) 222 | check-infer with:1 223 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 224 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 225 | #(struct:evar one) 226 | equal-nf? with 1 #(struct:vset) #(struct:vset) 227 | up-g with: 228 | #hash((one . #(struct:vset)) (two . #(struct:vset))) 229 | #(struct:pvar rt) 230 | #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))))): 231 | #(struct:vfun #(struct:sclos #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))))) 232 | check with: 233 | 0 234 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 235 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 236 | #(struct:edecl #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) #(struct:eone)) 237 | #(struct:vunit) 238 | check-decl with: 239 | 0 240 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 241 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 242 | #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))))) 243 | check-type with: 244 | 0 245 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 246 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 247 | #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) 248 | check-type with: 249 | 0 250 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 251 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 252 | #(struct:evar two) 253 | check with: 254 | 0 255 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 256 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 257 | #(struct:evar two) 258 | #(struct:vset) 259 | check-infer with:0 260 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 261 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 262 | #(struct:evar two) 263 | equal-nf? with 0 #(struct:vset) #(struct:vset) 264 | up-g with: 265 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 266 | #(struct:pvar b) 267 | #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))): 268 | #(struct:vnt #(struct:ntgen 0)) 269 | check-type with: 270 | 1 271 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 272 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 273 | #(struct:eapp #(struct:evar rt) #(struct:evar b)) 274 | check with: 275 | 1 276 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 277 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 278 | #(struct:eapp #(struct:evar rt) #(struct:evar b)) 279 | #(struct:vset) 280 | check-infer with:1 281 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 282 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 283 | #(struct:eapp #(struct:evar rt) #(struct:evar b)) 284 | check-infer with:1 285 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 286 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 287 | #(struct:evar rt) 288 | check with: 289 | 1 290 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 291 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 292 | #(struct:evar b) 293 | #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) 294 | check-infer with:1 295 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pvar b) #(struct:vnt #(struct:ntgen 0))) 296 | #hash((b . #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil)))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 297 | #(struct:evar b) 298 | equal-nf? with 1 #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) 299 | equal-nf? with 1 #(struct:vset) #(struct:vset) 300 | check with: 301 | 0 302 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 303 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 304 | #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone))))) 305 | #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))))) 306 | check with: 307 | 0 308 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 309 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 310 | #(struct:elam #(struct:pwild) #(struct:eone)) 311 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))))) 't)) 312 | up-g with: 313 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 314 | #(struct:pwild) 315 | #(struct:vunit): 316 | #(struct:vnt #(struct:ntgen 0)) 317 | check with: 318 | 1 319 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 320 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 321 | #(struct:eone) 322 | #(struct:vunit) 323 | check with: 324 | 0 325 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 326 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 327 | #(struct:elam #(struct:pwild) #(struct:eone)) 328 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))))) 't)) 329 | up-g with: 330 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 331 | #(struct:pwild) 332 | #(struct:vunit): 333 | #(struct:vnt #(struct:ntgen 0)) 334 | check with: 335 | 1 336 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 337 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 338 | #(struct:eone) 339 | #(struct:vunit) 340 | check with: 341 | 0 342 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 343 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 344 | #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone))) 345 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))))) 'f)) 346 | up-g with: 347 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 348 | #(struct:pwild) 349 | #(struct:vunit): 350 | #(struct:vnt #(struct:ntgen 0)) 351 | check with: 352 | 1 353 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 354 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 355 | #(struct:econ 'tt #(struct:eone)) 356 | #(struct:vsum #(struct:sclos #hash(('tt . #(struct:eunit))) #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))))) 357 | check with: 358 | 1 359 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 360 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 361 | #(struct:eone) 362 | #(struct:vunit) 363 | check with: 364 | 0 365 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) 366 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 367 | #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone))) 368 | #(struct:vpi #(struct:vunit) #(struct:cmp #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))))) 'f)) 369 | up-g with: 370 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 371 | #(struct:pwild) 372 | #(struct:vunit): 373 | #(struct:vnt #(struct:ntgen 0)) 374 | check with: 375 | 1 376 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 377 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 378 | #(struct:econ 'tt #(struct:eone)) 379 | #(struct:vsum #(struct:sclos #hash(('tt . #(struct:eunit))) #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))))) 380 | check with: 381 | 1 382 | #(struct:tupvar #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:pwild) #(struct:vnt #(struct:ntgen 0))) 383 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 384 | #(struct:eone) 385 | #(struct:vunit) 386 | up-g with: 387 | #hash((one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 388 | #(struct:pvar func) 389 | #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))))): 390 | #(struct:vfun #(struct:sclos #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone)))) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))))) 391 | check with: 392 | 0 393 | #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit))))))) #(struct:ddec #(struct:pvar func) #(struct:epi #(struct:pvar b) #(struct:evar two) #(struct:eapp #(struct:evar rt) #(struct:evar b))) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:econ 'tt #(struct:eone)))) ('t . #(struct:elam #(struct:pwild) #(struct:eone))))))) 394 | #hash((func . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pvar b) #(struct:eapp #(struct:evar rt) #(struct:evar b)) #(struct:tupdec #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit)))))) #(struct:ddec #(struct:pvar rt) #(struct:epi #(struct:pwild) #(struct:evar two) #(struct:eset)) #(struct:efun #hash(('f . #(struct:elam #(struct:pwild) #(struct:evar one))) ('t . #(struct:elam #(struct:pwild) #(struct:eunit)))))))))) (one . #(struct:vset)) (rt . #(struct:vpi #(struct:vsum #(struct:sclos #hash(('f . #(struct:eunit)) ('t . #(struct:eunit))) #(struct:tnil))) #(struct:cls #(struct:pwild) #(struct:eset) #(struct:tupdec #(struct:tupdec #(struct:tnil) #(struct:ddec #(struct:pvar two) #(struct:eset) #(struct:esum #hash(('f . #(struct:eunit)) ('t . #(struct:eunit)))))) #(struct:ddec #(struct:pvar one) #(struct:eset) #(struct:esum #hash(('tt . #(struct:eunit))))))))) (two . #(struct:vset))) 395 | #(struct:eone) 396 | #(struct:vunit) 397 | typecheck complete! 398 | -------------------------------------------------------------------------------- /translate.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | ;; this module provides a naive implementation of translating 4 | ;; rkttt -> rkt 5 | 6 | (require "expr.rkt") 7 | 8 | (: translate-decls (-> (Listof Decl) (Listof (Listof Symbol)))) 9 | (define (translate-decls ds) 10 | (match ds 11 | ['() empty] 12 | [(cons x xs) 13 | (cons (translate-decl x) (translate-decls xs))])) 14 | 15 | (: translate-decl (-> Decl (Listof Symbol))) 16 | (define (translate-decl d) 17 | (match d 18 | [(ddec n _ b) 19 | `(define ,(translate-patt n) ,(translate-expression b))] 20 | [(drec n _ b) 21 | `(define ,(translate-patt n) ,(translate-expression b))])) 22 | 23 | (: translate-expression (-> Expr Symbol)) 24 | (define (translate-expression e) 25 | (match e 26 | [_ (error "todo")])) 27 | 28 | (: translate-patt (-> Patt Symbol)) 29 | (define (translate-patt patt) 30 | (error "undefined")) 31 | -------------------------------------------------------------------------------- /val.rkt: -------------------------------------------------------------------------------- 1 | #lang typed/racket 2 | 3 | (provide (all-defined-out)) 4 | 5 | (require "expr.rkt") 6 | 7 | (define-type Val (U vlam vpair vcon vunit vset 8 | vone vpi vsigma vfun vsum vnt)) 9 | 10 | (struct vlam 11 | ([clos : Clos]) #:transparent) 12 | 13 | (struct vpair 14 | ([lhs : Val] 15 | [rhs : Val]) #:transparent) 16 | 17 | (struct vcon 18 | ([name : Symbol] 19 | [val : Val]) #:transparent) 20 | 21 | (struct vunit () #:transparent) 22 | 23 | (struct vset () #:transparent) 24 | 25 | (struct vone () #:transparent) 26 | 27 | (struct vpi 28 | ([val : Val] 29 | [clos : Clos]) #:transparent) 30 | 31 | (struct vsigma 32 | ([val : Val] 33 | [clos : Clos]) #:transparent) 34 | 35 | (struct vfun 36 | ([clos : SClos]) #:transparent) 37 | 38 | (struct vsum 39 | ([clos : SClos]) #:transparent) 40 | 41 | (struct vnt 42 | ([nt : Neut]) #:transparent) 43 | 44 | (define-type Neut (U ntgen ntapp ntfst ntsnd ntfun)) 45 | 46 | (struct ntgen 47 | ([n : Integer]) #:transparent) 48 | 49 | (struct ntapp 50 | ([rator : Neut] 51 | [rand : Val]) #:transparent) 52 | 53 | (struct ntfst 54 | ([nt : Neut]) #:transparent) 55 | 56 | (struct ntsnd 57 | ([nt : Neut]) #:transparent) 58 | 59 | (struct ntfun 60 | ([clos : SClos] 61 | [nt : Neut]) #:transparent) 62 | 63 | (define-type Clos (U cls cmp cval)) 64 | 65 | (struct cls 66 | ([patt : Patt] 67 | [exp : Expr] 68 | [rho : Telescope]) #:transparent) 69 | 70 | (struct cmp 71 | ([clos : Clos] 72 | [name : Symbol]) #:transparent) 73 | 74 | (struct cval 75 | ([val : Val]) #:transparent) 76 | 77 | (define-type Telescope (U tnil tupvar tupdec)) 78 | 79 | (define-type SClos sclos) 80 | 81 | (struct sclos 82 | ([branch : Branch] 83 | [rho : Telescope]) #:transparent) 84 | 85 | (struct tnil () #:transparent) 86 | 87 | (struct tupvar 88 | ([rho : Telescope] 89 | [patt : Patt] 90 | [val : Val]) #:transparent) 91 | 92 | (struct tupdec 93 | ([rho : Telescope] 94 | [decl : Decl]) #:transparent) 95 | --------------------------------------------------------------------------------