TiML: A Functional Programming Language with Time Complexity
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
compiler
emacs
examples
jupyter
micro-timl
parser
proof
sexp
.gitignore
.gitmodules
.hgignore
Dockerfile
Makefile
Makefile-truth.txt
README.md
archive.sh
base-sorts.sml
base-types.sml
bigO-solver.sml
bind.sml
check-no-uvar.sml
collect-mod.sml
collect-uvar.sml
collect-var.sml
common-smlnj-commands.sml
cont-mlton.sml
cont-smlnj.sml
datatype.sig
derived-trans.sml
docker-build-and-run.sh
docker-run-on-cloud-server.sh
elaborate.sml
enumerator.sml
equal.sml
export.sml
expr-fn.sml
expr-trans.sml
expr-util.sml
expr-visitor.sml
expr.sig
expr.sml
format.rb
fresh-uvar.sml
generate-file-list.rb
get-region.sml
hyp.sml
idx-trans.sml
idx-type-expr-fn.sml
idx-type-expr.sig
idx-util.sml
idx-visitor.sml
idx.sig
idx.sml
list-pair-map.sml
long-id-map.sml
long-id-subst.sml
long-id.sml
main-truth.cm
main-truth.mlb
main.sh
main.sml
map-util.sml
merge-modules.sml
mlton-main.sml
module-context.sml
name-resolve.sml
normalize.sml
nouvar-expr.sml
operators.sml
package.sml
parallel-subst.sml
parse-filename.sml
pattern-visitor.sml
pattern.sml
post-typecheck.sml
pp-util.sml
prettyprint
profile-batch-mode.txt
profile-single-mode.txt
profile.sh
redundant-exhaust.sml
region.sml
remove-open.sml
set-util.sml
shift-util.sml
simp-ctx.sml
simp-expr.sml
simp-type.sml
simp.sml
sml-mode-from-dorm-pc.el
sml-mode.el
smt-solver.sml
smt2-printer.sml
string-key.sml
subst-uvar.sml
subst.sml
t-ast.sml
test-mlton.sh
test.sh
time.sml
timl
timl-smlnj
to-string-nameful.sml
to-string-raw.sml
to-string-util.sml
to-string.sml
todo.md
trivial-solver.sml
type-trans.sml
type-util.sml
type-visitor.sml
type.sig
type.sml
typecheck-main.sml
typecheck-util.sml
typecheck.sml
unbound.sml
underscore-exprs.sml
unify.sml
unique-map.sml
unit-test.sml
unpackage.sml
update-expr.sml
util.sml
uvar-forget.sml
uvar.sig
uvar.sml
vc.sml
visitor-util.sml
visitor.sml

README.md

TiML: A Functional Programming Language with Time Complexity (Parser, Typechecker and Coq Formalization)

Setup Instructions

  1. Install SML/NJ. Make sure command sml and ml-build is in current PATH. On Ubuntu, use this command to install all necessary components of SML/NJ:

    sudo apt-get install smlnj libsmlnj-smlnj ml-yacc ml-ulex
    
  2. Install the Z3 SMT solver version 4.4.1. Make sure command z3 is in current PATH. Z3-4.4.1 is required. Z3-4.4.2 has a known issue.

  3. Install Ruby. Make sure command ruby is in current PATH.

  4. Use make to build TiML, or use ./test.sh to build and test on files in examples sub-directory.

  5. (Optional). Install MLton (a whole-program optimizing SML compiler). Make sure command mlton, mlyacc and mllex is in current PATH. Use make mlton to build TiML with MLton, or use ./test-mlton.sh to build and test on files in examples sub-directory.

  6. (Optional, requires step 5). Run ruby benchmark.rb in directory examples, which will generate file result.csv that reproduces results in Table 1 of the paper.

  7. (Optional). Follow emacs/README.rst to install TiML mode on Emacs.

Play with TiML

examples/test-suite.pkg lists all the benchmark examples. You can use this command to run all the examples:

./main.sh examples/stdlib.pkg examples/test-suite.pkg

or this command to run a single example:

./main.sh examples/stdlib.pkg examples/FILENAME.timl

Note that examples/stdlib.pkg (the standard library) is usually needed.

Readers are advised to read the example files following the order in Table 1 of the companion paper (and in file examples/test-suite.pkg), as new syntax are explained in that order.

To reproduce the results in Table 1 of the companion paper, you can run

cd examples
ruby benchmark.rb

The results will be printed out and written to file "result.csv". Note that this experiment requires MLton, and your processing time may vary.

Coq Proof

The Coq formalization of TiML and its soundness is in proof/Soundness.v. The proof requires Coq 8.5pl3. To check the proof, first compile the utility library:

make

You can also compile the utility library and the soundness proof altogether:

make soundness