readme: add syntax description and roadmap

This commit is contained in:
Michael Sippel 2024-05-01 17:07:47 +02:00
parent d7502e6af8
commit 101089fc77
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -5,6 +5,8 @@ Rust Implementation of Ladder-Types (parsing, unification, rewriting, etc)
## Ladder Types ## Ladder Types
### Motivation
In order to implement complex datastructures and algorithms, usually In order to implement complex datastructures and algorithms, usually
many layers of abstraction are built ontop of each other. many layers of abstraction are built ontop of each other.
Consequently higher-level data types are encoded into lower-level data Consequently higher-level data types are encoded into lower-level data
@ -57,6 +59,32 @@ this:
1696093021:1696093039:1528324679:1539892301:1638141920:1688010253 1696093021:1696093039:1528324679:1539892301:1638141920:1688010253
``` ```
### Syntax
A type-term can be of the form:
- `0` | `1` | `2` | ... (**Literal Integer**)
- `'a'` | `'b'` | `'c'` | ... (**Literal Character**)
- `SomeTypeName` (**Atomic Type**)
- `<T_1 T_2>` given `T_1` and `T_2` are type-terms. (**Parameter Application**)
- `T_1 ~ T_2` given `T_1` and `T_2` are type-terms. (**Ladder**)
Ontop of that, the following syntax-sugar is defined:
#### Complex Types
- `[T]` <===> `<Seq T>`
- `{a:A,b:B}` <===> `<Struct <"a" A> <"b" B>>`
- `a:A|b:B` <===> `<Enum <"a" A> <"b" B>>`
#### Function Types
- `A -> B` <===> `<Fn A B>`
#### Reference Types
- `*A` <===> `<Ptr A>`
- `&A` <===> `<ConstRef A>`
- `&!A` <===> `<MutRef A>`
## How to use this crate ## How to use this crate
```rust ```rust
@ -73,6 +101,19 @@ fn main() {
} }
``` ```
## Roadmap
- [x] (Un-)Parsing
- [x] (De-)Currying
- [x] Unification
- [x] Ladder-Normal-Form
- [x] Parameter-Normal-Form
- [ ] (De)-Sugaring
- [ ] Seq
- [ ] Enum
- [ ] Struct
- [ ] References
- [ ] Function
## License ## License
[GPLv3](COPYING) [GPLv3](COPYING)