https://github.com/dimasmith/brainterpreter
Draft implementation of a toy programming language interpreter. For educational purposes.
https://github.com/dimasmith/brainterpreter
compilers interpreters virtual-machines
Last synced: about 1 month ago
JSON representation
Draft implementation of a toy programming language interpreter. For educational purposes.
- Host: GitHub
- URL: https://github.com/dimasmith/brainterpreter
- Owner: dimasmith
- Created: 2023-03-28T21:31:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-21T22:52:39.000Z (11 months ago)
- Last Synced: 2024-05-22T11:13:29.485Z (11 months ago)
- Topics: compilers, interpreters, virtual-machines
- Language: Rust
- Homepage: https://dimasmith.github.io/brainterpreter/
- Size: 1.45 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Brainterpreter
[](https://github.com/dimasmith/brainterpreter/actions/workflows/rust.yml)
[](https://codecov.io/gh/dimasmith/brainterpreter)
[](https://github.com/dimasmith/brainterpreter/actions/workflows/znai-pages-deploy.yml)An interpreter for a Bauble programming language.
Created for TechIn talks in [Levi9](https://www.levi9.com/).NOTE: it is a sandbox of the implementation.
I plan to deliver a new repository with the same functionality but better suited for education.An interpreter is created as an educational experiment.
The main goal is to run the interpreter of [Brainfuck](https://esolangs.org/wiki/Brainfuck) written in this toy language.
You can check a "hello, world" in `examples` section.## What's inside?
The repository containts parser, compiler, and virtual machine for a Bauble programming language.
The language has C-like syntax. Supported features:- arithmetics;
- strings;
- boolean values;
- if statement;
- while loop;
- arrays;## What's Bauble?
Bauble is a toy programming language created specifically for a tech talk.
## Documentation
Please check the [project pages](https://dimasmith.github.io/brainterpreter/) for some docs.
Documenting is still very much in progress.
## Running interpreter
By default, the project builds as a library with all parts to run the interpreter.
If you don't want to build your own binary, build brainterpreter with the `cli` feature enabled.```shell
cargo build --features cli
```The `cli` feature provides a `bauble` binary.
`bauble` runs the interpreter for a given source file.If you want to trace the virtual machine execution for your program, set logging level to `debug`:
```shell
RUST_LOG=debug bauble examples/hello_world.bbl run
```After the build the binary can be found in `target/debug/bauble` (or `target/release/bauble` if you build with `--release` flag).
You can also run the interpreter with the `cargo run` command:
```shell
cargo run --features cli -- examples/hello_world.bbl
```