Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type inference #2

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
7f183b1
finish all rules
PPER Mar 21, 2020
9b7ecd4
tex some thm
PPER Mar 22, 2020
995d74d
consistent equivalent/less rules
PPER Mar 23, 2020
50e7d10
fix some errors
PPER Jun 4, 2020
ecfebb8
define data structure
PPER Jun 8, 2020
89dc93c
syn and ana func
PPER Jun 10, 2020
7b7b79f
finish implemention draft
PPER Jun 10, 2020
a4953f6
change return type
PPER Jun 11, 2020
a17813d
start to test
PPER Jun 11, 2020
84136c0
delete TBD
PPER Jun 11, 2020
5045557
try to use parser but failed
PPER Jun 16, 2020
7763fd4
test
PPER Jun 16, 2020
77339a1
fix bugs of updating variable
PPER Jun 16, 2020
f974b38
change file structure
PPER Jun 16, 2020
7432225
change a little to make pull request
PPER Jun 16, 2020
9663d38
simplify test.ml
PPER Jun 16, 2020
69efb05
gitignore
PPER Jun 16, 2020
e0fa177
a file cannot delete
PPER Jun 16, 2020
a796f2a
gitignore
PPER Jun 16, 2020
f4f5f3f
clear file structure
PPER Jun 16, 2020
0817892
more tc needed to be added
PPER Jun 16, 2020
550c592
questions and memo for 6/18 meeting
PPER Jun 18, 2020
e8dad16
add consistency
PPER Jun 18, 2020
c2fc2d4
illustration for new unification idea
PPER Jun 18, 2020
396feba
add some illustration examples
PPER Jun 18, 2020
7562457
Add abstract and half of Sec 3. fit judgement into template
PPER Jun 20, 2020
15ece00
refine abstract and add bidirectional typing
PPER Jun 21, 2020
94d5136
hide information
PPER Jun 21, 2020
f02c017
change ignore
PPER Jun 21, 2020
552ca6a
draft
PPER Jun 23, 2020
41dcaf8
extended abstract
PPER Jun 27, 2020
95d22f5
suggested edits
cyrus- Jun 27, 2020
ae13243
new substitute function
PPER Jun 30, 2020
39f5afb
make unify return a list of possible types when unification fails
PPER Jul 1, 2020
0e397b9
new version of unification
PPER Jul 1, 2020
a69b466
fix errors on recursive case
PPER Jul 2, 2020
2cf794a
add bool to unify_one
PPER Jul 6, 2020
c57855c
need to rethink this method
PPER Jul 6, 2020
ce64465
new version
PPER Jul 6, 2020
92c4ea1
modify unify
PPER Jul 6, 2020
d606a1b
add substitute
PPER Jul 7, 2020
a2a8af9
change list to array
PPER Jul 7, 2020
7730e56
reset to debug
PPER Jul 7, 2020
fa07f45
simplify
PPER Jul 10, 2020
c5952fa
complete
PPER Jul 10, 2020
d432382
clean up
PPER Jul 10, 2020
107ccef
clean up
PPER Jul 10, 2020
45e460b
ignore build files
PPER Jul 10, 2020
a3b8925
change gitignore
PPER Jul 10, 2020
1493606
extended syntax version
PPER Jul 13, 2020
570906d
questions
PPER Sep 16, 2020
3834e7e
reworking syn/ana to return constraints even on failure
anandrav May 26, 2021
0bb8b53
reverted changes from last commit
anandrav May 28, 2021
6688c14
added some test cases for when unify fails
anandrav May 28, 2021
0824dde
do not use
RaefM May 28, 2021
041bcc5
xMerge branch 'dev' of https://github.com/fplab/type-inference-paper …
RaefM May 28, 2021
28d8dbe
Updated test cases
RaefM May 28, 2021
a34b8ea
added comments with some todos/considerations
RaefM Jun 1, 2021
2a5ccac
more comments from discussion in meeting
RaefM Jun 4, 2021
460fed9
a whole bunch of changes; added ambiguous result status which is an i…
RaefM Jun 24, 2021
574b519
shifted from dirstats to a new set of unify results for recursive typ…
RaefM Jun 25, 2021
9a9bbb4
finished initial draft of changes. builds, but not tested
RaefM Jun 25, 2021
622a9a7
some quick cleanup. seems to work well (tentatively). consider using …
RaefM Jun 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pythontex-files-*/
# Texpad
.texpadtmp


# TikZ & PGF
*.dpth
*.md5
Expand All @@ -158,4 +159,6 @@ pythontex-files-*/
# Latexian
TSWLatexianTemp*

patterns-paper.pdf
type-inference-paper.pdf

*/_build
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
Binary file added 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4_gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAIN=patterns-paper
MAIN=type-inference-paper

all:
pdflatex $(MAIN)
Expand Down
Empty file added _build/default/.dune/.dune-keep
Empty file.
2 changes: 2 additions & 0 deletions _build/default/.dune/configurator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(ocamlc /home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlc.opt)
(ocaml_config_vars (afl_instrument false) (architecture amd64) (asm as) (asm_cfi_supported true) (ast_impl_magic_number Caml1999M025) (ast_intf_magic_number Caml1999N025) (bytecomp_c_compiler "gcc -O2 -fno-strict-aliasing -fwrapv -fcommon -fPIC -D_FILE_OFFSET_BITS=64 -D_REENTRANT") (bytecomp_c_libraries "-lm -ldl -lpthread ") (c_compiler gcc) (cc_profile -pg) (ccomp_type cc) (cma_magic_number Caml1999A025) (cmi_magic_number Caml1999I025) (cmo_magic_number Caml1999O025) (cmt_magic_number Caml1999T025) (cmx_magic_number Caml1999Y025) (cmxa_magic_number Caml1999Z025) (cmxs_magic_number Caml1999D025) (default_executable_name a.out) (default_safe_string true) (exec_magic_number Caml1999X025) (ext_asm .s) (ext_dll .so) (ext_exe "") (ext_lib .a) (ext_obj .o) (flambda false) (flat_float_array true) (host x86_64-pc-linux-gnu) (int_size 63) (model default) (native_c_compiler "gcc -O2 -fno-strict-aliasing -fwrapv -fcommon -D_FILE_OFFSET_BITS=64 -D_REENTRANT") (native_c_libraries "-lm -ldl ") (native_pack_linker "ld -r -o ") (ocamlc_cflags "-O2 -fno-strict-aliasing -fwrapv -fcommon -fPIC") (ocamlc_cppflags "-D_FILE_OFFSET_BITS=64 -D_REENTRANT") (ocamlopt_cflags "-O2 -fno-strict-aliasing -fwrapv -fcommon") (ocamlopt_cppflags "-D_FILE_OFFSET_BITS=64 -D_REENTRANT") (os_type Unix) (profiling true) (ranlib ranlib) (safe_string false) (spacetime false) (standard_library /home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml) (standard_library_default /home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml) (supports_shared_libraries true) (system linux) (systhread_supported true) (target x86_64-pc-linux-gnu) (version 4.08.1) (windows_unicode false) (with_frame_pointers false) (word_size 64))
1 change: 1 addition & 0 deletions _build/default/.dune/configurator.v2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((6:ocamlc61:/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlc.opt)(17:ocaml_config_vars((14:afl_instrument5:false)(12:architecture5:amd64)(3:asm2:as)(17:asm_cfi_supported4:true)(21:ast_impl_magic_number12:Caml1999M025)(21:ast_intf_magic_number12:Caml1999N025)(19:bytecomp_c_compiler87:gcc -O2 -fno-strict-aliasing -fwrapv -fcommon -fPIC -D_FILE_OFFSET_BITS=64 -D_REENTRANT)(20:bytecomp_c_libraries20:-lm -ldl -lpthread )(10:c_compiler3:gcc)(10:cc_profile3:-pg)(10:ccomp_type2:cc)(16:cma_magic_number12:Caml1999A025)(16:cmi_magic_number12:Caml1999I025)(16:cmo_magic_number12:Caml1999O025)(16:cmt_magic_number12:Caml1999T025)(16:cmx_magic_number12:Caml1999Y025)(17:cmxa_magic_number12:Caml1999Z025)(17:cmxs_magic_number12:Caml1999D025)(23:default_executable_name5:a.out)(19:default_safe_string4:true)(17:exec_magic_number12:Caml1999X025)(7:ext_asm2:.s)(7:ext_dll3:.so)(7:ext_exe0:)(7:ext_lib2:.a)(7:ext_obj2:.o)(7:flambda5:false)(16:flat_float_array4:true)(4:host19:x86_64-pc-linux-gnu)(8:int_size2:63)(5:model7:default)(17:native_c_compiler81:gcc -O2 -fno-strict-aliasing -fwrapv -fcommon -D_FILE_OFFSET_BITS=64 -D_REENTRANT)(18:native_c_libraries9:-lm -ldl )(18:native_pack_linker9:ld -r -o )(13:ocamlc_cflags47:-O2 -fno-strict-aliasing -fwrapv -fcommon -fPIC)(15:ocamlc_cppflags35:-D_FILE_OFFSET_BITS=64 -D_REENTRANT)(15:ocamlopt_cflags41:-O2 -fno-strict-aliasing -fwrapv -fcommon)(17:ocamlopt_cppflags35:-D_FILE_OFFSET_BITS=64 -D_REENTRANT)(7:os_type4:Unix)(9:profiling4:true)(6:ranlib6:ranlib)(11:safe_string5:false)(9:spacetime5:false)(16:standard_library56:/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml)(24:standard_library_default56:/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml)(25:supports_shared_libraries4:true)(6:system5:linux)(19:systhread_supported4:true)(6:target19:x86_64-pc-linux-gnu)(7:version6:4.08.1)(15:windows_unicode5:false)(19:with_frame_pointers5:false)(9:word_size2:64))))
131 changes: 131 additions & 0 deletions _build/log
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# dune build test.exe
# OCAMLPARAM: unset
# Workspace root: /home/maroofr/type-inference-paper
$ /usr/bin/nproc > /tmp/dunef44937.output 2> /dev/null
# Auto-detected concurrency: 4
# disable binary cache
$ /home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlc.opt -config > /tmp/dune338217.output
# Dune context:
# { name = "default"
# ; kind = "default"
# ; profile = Dyn
# ; merlin = true
# ; for_host = None
# ; fdo_target_exe = None
# ; build_dir = "default"
# ; toplevel_path =
# Some
# External "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/toplevel"
# ; ocaml_bin = External "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin"
# ; ocaml =
# Ok External "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocaml"
# ; ocamlc =
# External "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlc.opt"
# ; ocamlopt =
# Ok
# External
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlopt.opt"
# ; ocamldep =
# Ok
# External
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamldep.opt"
# ; ocamlmklib =
# Ok
# External
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/bin/ocamlmklib.opt"
# ; env =
# map
# { "DUNE_OCAML_HARDCODED" :
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib"
# ; "DUNE_OCAML_STDLIB" :
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml"
# ; "DUNE_SOURCEROOT" : "/home/maroofr/type-inference-paper"
# ; "INSIDE_DUNE" : "/home/maroofr/type-inference-paper/_build/default"
# ; "OCAMLFIND_IGNORE_DUPS_IN" :
# "/home/maroofr/type-inference-paper/_build/install/default/lib"
# ; "OCAMLPATH" :
# "/home/maroofr/type-inference-paper/_build/install/default/lib"
# ; "OCAMLTOP_INCLUDE_PATH" :
# "/home/maroofr/type-inference-paper/_build/install/default/lib/toplevel"
# ; "OCAML_COLOR" : "always"
# ; "OPAMCOLOR" : "always"
# }
# ; findlib_path =
# [ External "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib" ]
# ; arch_sixtyfour = true
# ; natdynlink_supported = true
# ; supports_shared_libraries = true
# ; ocaml_config =
# { version = "4.08.1"
# ; standard_library_default =
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml"
# ; standard_library =
# "/home/maroofr/.opam/ocaml-base-compiler.4.08.1/lib/ocaml"
# ; standard_runtime = "the_standard_runtime_variable_was_deleted"
# ; ccomp_type = "cc"
# ; c_compiler = "gcc"
# ; ocamlc_cflags =
# [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-fcommon"; "-fPIC" ]
# ; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64"; "-D_REENTRANT" ]
# ; ocamlopt_cflags =
# [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-fcommon" ]
# ; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64"; "-D_REENTRANT" ]
# ; bytecomp_c_compiler =
# [ "gcc"
# ; "-O2"
# ; "-fno-strict-aliasing"
# ; "-fwrapv"
# ; "-fcommon"
# ; "-fPIC"
# ; "-D_FILE_OFFSET_BITS=64"
# ; "-D_REENTRANT"
# ]
# ; bytecomp_c_libraries = [ "-lm"; "-ldl"; "-lpthread" ]
# ; native_c_compiler =
# [ "gcc"
# ; "-O2"
# ; "-fno-strict-aliasing"
# ; "-fwrapv"
# ; "-fcommon"
# ; "-D_FILE_OFFSET_BITS=64"
# ; "-D_REENTRANT"
# ]
# ; native_c_libraries = [ "-lm"; "-ldl" ]
# ; cc_profile = [ "-pg" ]
# ; architecture = "amd64"
# ; model = "default"
# ; int_size = 63
# ; word_size = 64
# ; system = "linux"
# ; asm = [ "as" ]
# ; asm_cfi_supported = true
# ; with_frame_pointers = false
# ; ext_exe = ""
# ; ext_obj = ".o"
# ; ext_asm = ".s"
# ; ext_lib = ".a"
# ; ext_dll = ".so"
# ; os_type = "Unix"
# ; default_executable_name = "a.out"
# ; systhread_supported = true
# ; host = "x86_64-pc-linux-gnu"
# ; target = "x86_64-pc-linux-gnu"
# ; profiling = true
# ; flambda = false
# ; spacetime = false
# ; safe_string = false
# ; exec_magic_number = "Caml1999X025"
# ; cmi_magic_number = "Caml1999I025"
# ; cmo_magic_number = "Caml1999O025"
# ; cma_magic_number = "Caml1999A025"
# ; cmx_magic_number = "Caml1999Y025"
# ; cmxa_magic_number = "Caml1999Z025"
# ; ast_impl_magic_number = "Caml1999M025"
# ; ast_intf_magic_number = "Caml1999N025"
# ; cmxs_magic_number = "Caml1999D025"
# ; cmt_magic_number = "Caml1999T025"
# ; natdynlink_supported = true
# ; supports_shared_libraries = true
# ; windows_unicode = false
# }
# }
7 changes: 7 additions & 0 deletions abstract.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
% !TEX root = hazel-LIVE2018.tex

\begin{abstract}
\emph{Type inference} allows programmers to omit type annotations while still permitting type checking. The problem is that \emph{type inference} only works on complete programs, e.g. syntactically well-formed expressions. This paper introduces a \emph{type hole inference} system that applies type inference on incomplete programs. We start from modeling incomplete programs by lambda calculus with \emph{holes} developed in \Hazelnut, where holes stand for missing types and expressions. We extended static semantics with \emph{type constraints}, and borrow machinery from unification-based type inference to infer types for type holes by identifying the type hole with the type variable. In particular, our system will not report a static error when unification fails but postpone type-checking for type holes to runtime. This provides an approach to combine \emph{gradual typing} and \emph{type inference}.

\end{abstract}

Loading