https://github.com/lightquantumarchive/l-lang-parser-rs
A parser for a toy strict untyped λ-calculus language called L-lang.
https://github.com/lightquantumarchive/l-lang-parser-rs
Last synced: 10 months ago
JSON representation
A parser for a toy strict untyped λ-calculus language called L-lang.
- Host: GitHub
- URL: https://github.com/lightquantumarchive/l-lang-parser-rs
- Owner: LightQuantumArchive
- License: apache-2.0
- Created: 2020-11-23T18:43:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-06T19:32:51.000Z (about 4 years ago)
- Last Synced: 2025-08-15T03:51:16.810Z (10 months ago)
- Language: Rust
- Size: 94.7 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# L-lang Parser
A parser for a toy strict untyped λ-calculus language called L-lang.
## Get Started
### L Language
You may view the syntax of L-lang in [l.pest](src/l.pest).
There's an example L-lang program called [examples/evenb.l](examples/evenb.l).
### Export to Coq code
``` coq
$ l-lang-parser-rs export run.l
Definition my_evenb: tm :=
(rec (abs "my_evenb"
(abs "n"
(mat (var "n") [
("S", ["x"],
(mat (var "x") [
("S", ["x"],
(app (var "my_evenb") (var "x")));
("O", [],
(const "false"))
]));
("O", [],
(const "true"))
])
)
)).
Definition main: tm :=
(app my_evenb (app (const "S") (app (const "S") (app (const "S") (app (const "S") (const "O")))))).
```
### Run program
``` coq
$ l-lang-parser-rs export run.l
= Some (const "true")
: option tm
```
## License
This project is licensed under the [Apache License 2.0](LICENSE.md).