fmt files
This commit is contained in:
parent
561aca4e05
commit
e942f30703
4 changed files with 31 additions and 34 deletions
45
README.md
45
README.md
|
@ -11,7 +11,6 @@ To realise this project you will implement a type inference
|
||||||
algorithm that works over terms of a programming language
|
algorithm that works over terms of a programming language
|
||||||
for functional programming.
|
for functional programming.
|
||||||
|
|
||||||
|
|
||||||
## Terms = Expressions = Programs
|
## Terms = Expressions = Programs
|
||||||
|
|
||||||
- [Term](./lib/term.mli) This module contains the syntax of
|
- [Term](./lib/term.mli) This module contains the syntax of
|
||||||
|
@ -21,7 +20,6 @@ for functional programming.
|
||||||
thanks to the constructors for application (`App`) and
|
thanks to the constructors for application (`App`) and
|
||||||
for function definition (`Fun`).
|
for function definition (`Fun`).
|
||||||
|
|
||||||
|
|
||||||
## Aim of the project
|
## Aim of the project
|
||||||
|
|
||||||
The [third lecture]
|
The [third lecture]
|
||||||
|
@ -35,36 +33,34 @@ To realise this project you will have to implement the following modules:
|
||||||
|
|
||||||
1. [typeSubstitution](./lib/typeSubstituion.ml)
|
1. [typeSubstitution](./lib/typeSubstituion.ml)
|
||||||
You must implement at least:
|
You must implement at least:
|
||||||
- [ ] `type t`, i.e. how to represent syntactic substitutions in memory,
|
|
||||||
- [ ] `val apply`, which applies a syntactic substitution to a type
|
|
||||||
- [ ] `val compose`, which computes the substitution obtained composing two given substitutions.
|
|
||||||
|
|
||||||
|
- [ ] `type t`, i.e. how to represent syntactic substitutions in memory,
|
||||||
|
- [ ] `val apply`, which applies a syntactic substitution to a type
|
||||||
|
- [ ] `val compose`, which computes the substitution obtained composing two given substitutions.
|
||||||
|
|
||||||
1. [unifcation](./lib/unification.ml)
|
1. [unifcation](./lib/unification.ml)
|
||||||
You must implement at least:
|
You must implement at least:
|
||||||
|
|
||||||
- [ ] `val unify` which given two type `t1` and `t2`,
|
- [ ] `val unify` which given two type `t1` and `t2`,
|
||||||
must compute the substitution `s` such that if
|
must compute the substitution `s` such that if
|
||||||
`unify t1 t2 = Some s` then `apply s t1 = apply s t2`.
|
`unify t1 t2 = Some s` then `apply s t1 = apply s t2`.
|
||||||
|
|
||||||
You can of course use the Herbrand / Robinson algorithm
|
You can of course use the Herbrand / Robinson algorithm
|
||||||
to start designing your implementation.
|
to start designing your implementation.
|
||||||
|
|
||||||
|
|
||||||
1. [inference](./lib/inference.ml)
|
1. [inference](./lib/inference.ml)
|
||||||
You must implement at least:
|
You must implement at least:
|
||||||
- [ ] `val typeof`, which given a term `t` must compute either
|
- [ ] `val typeof`, which given a term `t` must compute either
|
||||||
`None`, if there is no type for `t`, or `Some ty`, if ty is the type of term `t`.
|
`None`, if there is no type for `t`, or `Some ty`, if ty is the type of term `t`.
|
||||||
|
|
||||||
You may add more definitions to each of these modules, and extend their signatures accordingly.
|
You may add more definitions to each of these modules, and extend their signatures accordingly.
|
||||||
You may also create new compilation units (i.e. new `.ml` files).
|
You may also create new compilation units (i.e. new `.ml` files).
|
||||||
|
|
||||||
1. You may, and *should*, extend the [testing module](./test/test_projet_pfa_23_24.ml) with additional
|
1. You may, and _should_, extend the [testing module](./test/test_projet_pfa_23_24.ml) with additional
|
||||||
tests, or replace it with a testing framework of your choice (using e.g. QCheck).
|
tests, or replace it with a testing framework of your choice (using e.g. QCheck).
|
||||||
|
|
||||||
|
|
||||||
## PART II: Logistics of the project
|
## PART II: Logistics of the project
|
||||||
|
|
||||||
|
|
||||||
## Fork
|
## Fork
|
||||||
|
|
||||||
To realise your project and have it evaluated,
|
To realise your project and have it evaluated,
|
||||||
|
@ -79,11 +75,10 @@ Do it asap.
|
||||||
|
|
||||||
The final implementation must be in your fork by the
|
The final implementation must be in your fork by the
|
||||||
|
|
||||||
__ 30th of April 2024, 23h59 __
|
** 30th of April 2024, 23h59 **
|
||||||
|
|
||||||
Any code pushed to your fork after that time will be ignored.
|
Any code pushed to your fork after that time will be ignored.
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
### 1. Install OPAM
|
### 1. Install OPAM
|
||||||
|
@ -93,9 +88,10 @@ is the recommended way to install the OCaml compiler and OCaml
|
||||||
packages.
|
packages.
|
||||||
|
|
||||||
The following should work for macOS and Linux:
|
The following should work for macOS and Linux:
|
||||||
````sh
|
|
||||||
|
```sh
|
||||||
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
|
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
|
||||||
````
|
```
|
||||||
|
|
||||||
### Recommended: editor integration
|
### Recommended: editor integration
|
||||||
|
|
||||||
|
@ -106,9 +102,10 @@ Emacs while [Merlin](https://github.com/ocaml/merlin) is an editor
|
||||||
service that provides modern IDE features for OCaml.
|
service that provides modern IDE features for OCaml.
|
||||||
|
|
||||||
To install, run:
|
To install, run:
|
||||||
````sh
|
|
||||||
|
```sh
|
||||||
opam install tuareg merlin user-setup
|
opam install tuareg merlin user-setup
|
||||||
````
|
```
|
||||||
|
|
||||||
#### VSCode: Ocaml LSP
|
#### VSCode: Ocaml LSP
|
||||||
|
|
||||||
|
@ -121,9 +118,10 @@ This extension requires
|
||||||
Protocol(LSP) implementation for OCaml
|
Protocol(LSP) implementation for OCaml
|
||||||
|
|
||||||
To install, run:
|
To install, run:
|
||||||
````sh
|
|
||||||
|
```sh
|
||||||
opam install ocaml-lsp-server
|
opam install ocaml-lsp-server
|
||||||
````
|
```
|
||||||
|
|
||||||
## Development environment setup
|
## Development environment setup
|
||||||
|
|
||||||
|
@ -134,7 +132,6 @@ $ opam switch create . --deps-only --with-doc --with-test
|
||||||
$ eval $(opam env)
|
$ eval $(opam env)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
To build the project, type:
|
To build the project, type:
|
||||||
|
@ -154,7 +151,7 @@ instead.
|
||||||
## Running your main file
|
## Running your main file
|
||||||
|
|
||||||
To run your code you will have to implement
|
To run your code you will have to implement
|
||||||
`let () = ...` in the file `main.ml`, and
|
`let () = ...` in the file `main.ml`, and
|
||||||
then run it via
|
then run it via
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
3
lib/dune
3
lib/dune
|
@ -1,3 +1,4 @@
|
||||||
(library
|
(library
|
||||||
(name typeInference)
|
(name typeInference)
|
||||||
(preprocess (pps ppx_deriving.show ppx_deriving.ord ppx_deriving.eq)))
|
(preprocess
|
||||||
|
(pps ppx_deriving.show ppx_deriving.ord ppx_deriving.eq)))
|
||||||
|
|
|
@ -4,4 +4,3 @@
|
||||||
- `Some ty`, if ty is the type of term `t`
|
- `Some ty`, if ty is the type of term `t`
|
||||||
*)
|
*)
|
||||||
val typeof : Term.t -> Type.t option
|
val typeof : Term.t -> Type.t option
|
||||||
|
|
||||||
|
|
Reference in a new issue