Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sano-jin/lmn-alpha
A minimal compiler and a runtime for a language based on graph rewriting
https://github.com/sano-jin/lmn-alpha
compiler interpreter programming-language
Last synced: about 1 month ago
JSON representation
A minimal compiler and a runtime for a language based on graph rewriting
- Host: GitHub
- URL: https://github.com/sano-jin/lmn-alpha
- Owner: sano-jin
- License: mit
- Created: 2021-08-11T14:17:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-06T04:00:36.000Z (over 1 year ago)
- Last Synced: 2023-06-06T05:20:19.618Z (over 1 year ago)
- Topics: compiler, interpreter, programming-language
- Language: OCaml
- Homepage: https://sano-jin.github.io/lmn-alpha/
- Size: 6.53 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lmn-alpha
_Experimental_A minimal compiler and a runtime for a language based on graph rewriting.
## Getting Started
### Prerequisites
- [opam](https://opam.ocaml.org/)### Installation
```bash
git clone https://github.com/sano-jin/lmn-alpha
cd lmn-alpha
opam install .
dune build
```## Usage
```bash
./run example/append.lmn -t
```If [the program (example/append.lmn)](example/append.lmn) is the following:
```
ret = append(cons(a, cons(b, nil)), cons(c, nil)).append_cons @@
R = append(cons(H, T), L) :- R = cons(H, append(T, L)).append_nil @@
R = append(nil, L) :- R = L.
```Then, the output will be the following:
```
0: append(cons(a, cons(b, nil)), cons(c, nil), ret)
----> append_cons
1: cons(a, append(cons(b, nil), cons(c, nil)), ret)
----> append_cons
2: cons(a, cons(b, append(nil, cons(c, nil))), ret)
----> append_nil
3: cons(a, cons(b, cons(c, nil)), ret)
Final state:
cons(a, cons(b, cons(c, nil)), ret)
```