brainterpreter

Crates.iobrainterpreter
lib.rsbrainterpreter
version0.1.2
sourcesrc
created_at2023-05-08 22:22:56.019016
updated_at2023-05-08 22:48:10.754622
descriptionAn interpreter for a Bauble toy programming language
homepagehttps://dimasmith.github.io/brainterpreter/
repositoryhttps://github.com/dimasmith/brainterpreter
max_upload_size
id860122
size1,647,378
Dmytro Kovalchuk (dimasmith)

documentation

https://docs.rs/brainterpreter

README

Brainterpreter

Build Coverage Documentation

An interpreter for a Bauble programming language. Created for TechIn talks in Levi9.

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 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 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.

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:

RUST_LOG=debug bauble examples/hello_world.bbl

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:

cargo run --features cli -- examples/hello_world.bbl
Commit count: 175

cargo fmt