Skip to content

About

a scripting language and interpreter in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

Appendix A: Masterwork - a scripting language and interpreter in Rust

Purpose

This artifact is an appendix, provided as a Git repository alongside a thesis. The intended reader is an examiner or reviewer who needs enough detail to reproduce the work, verify its claims, and assess its completeness independently of the thesis body.

Overview

Want to find ... File
Lexer: Converts text into tokens src/lexer.rs
Parser: Produces an AST src/parser.rs
Interpreter: Evaluates the AST src/interpreter.rs
A collection of tests. Can be used as reference. src/test/*.rs
CLI executable src/bin/cli.rs

The crate exposes four interfaces:

REPL for interactive evaluation

cargo run --release -- repl

run command that executes a script file

cargo run --release -- run scripts/syntax_overview.mw

interpret command that executes a string

cargo run --release -- interpret "1 + 1"

library API

use masterwork::Masterwork;
if let Some(result) = Masterwork::run("1 + 1") {
  println!("Program returned: {:?}", result);
}

Example programs

Five example scripts demonstrative of the language:

Example File
structs, constructors, methods, mutable state scripts/game.mw
PRNG and iterative estimation scripts/monte_carlo_pi_estimation.mw
a primitive JSON parser scripts/json.mw
HTML templating scripts/static_site_generator.mw
a syntax reference scripts/syntax_overview.mw

Ethical and academic considerations

All code is original, external dependencies are limited to published crates listed in Cargo.toml, and no copyrighted material was used without permission. LLM was used for refactoring.

About

a scripting language and interpreter in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages