https://github.com/butanium/projet-interp-lua
https://github.com/butanium/projet-interp-lua
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/butanium/projet-interp-lua
- Owner: Butanium
- Created: 2023-04-21T09:43:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T10:08:19.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T03:53:40.059Z (12 months ago)
- Language: C
- Size: 702 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Dependencies
In order to build the project, we need a few opam packages.
Using `opam`, run:
```
opam install dune menhir ppx_deriving ocaml-lsp-server ocamlformat-rpc
```
On the Rust side, a recent installation of cargo and rustc is needed.
## Usage
Building the project (both OCaml and Rust):
```
make
```
Running the tests (this uses all the .lua files in the `../lua/` directory as test files):
```
make test
```
To run the OCaml interpreter on a specific file `prog.lua`, move to the `ocaml` directory and type:
```
dune exec --display=quiet interp/run.exe -- prog.lua
```
Alternatively, if one wants to use the CPS variant of the OCaml
interpreter (supporting coroutines), the she can use the command:
```
dune exec --display=quiet interp-cps/run.exe -- prog.lua
```
To run the Rust interpreter on a specific file `prog.lua`, move to the `rust` directory and type:
```
cargo run --release -- prog.lua
```
One can remove the `--release` option in order to disable optimizations.
To show the syntax tree corresponding to a mini-Lua program `prog.lua` after parsing by the OCaml parser (the AST in Rust should be equivalent):
```
dune exec --display=quiet showast/showast.exe -- prog.lua
```
The *lua reference interpreter* source is in the `lua` directory. It can be built by typing `make refinterp`, and run using:
```
lua/mini_lua.sh prog.lua
```