Home

Awesome

rusty-parser

A self-learning project for making a new language using Rust and nom.

Try it now on your browser! https://msakuta.github.io/rusty-parser/

Requirements

How to build

There are 2 ways to build this project.

Command line interpreter

One is for native command line application. It can read a text file, parse it to an AST and run it.

cd cli
cargo run --release -- <script-file>.dragon

You can type check the script before running with -t switch. It will ensure that the declared types are correct before running the script. The language itself is still dynamically typed, but it will help writing robust software.

cargo run --release -- -t

We have our own bytecode format that you can compile.

cargo run --release -- -c <script-file>.dragon

It will create an output file "out.cdragon" which is a pre-compiled bytecode that can run faster than AST interpreter. It is similart to ".pyc" file against ".py" in Python.

You can also compile and run at the same time.

cargo run --release -- -cR <script-file>.dragon

If you have a pre-compiled bytecode file, you can just run it without compiling as:

cargo run --release -- -b <bytecode>.cdragon

WebAssembly browser application

You can also build a wasm package and run the interpreter on the browser.

cd wasm
npm run build

To launch the application, you can use npx

cd dist
npx serve

and browse http://localhost:5000.

TODOs

In ascending order of difficulty.

Ideas

I want to make it a complementary DSL for data manipulation, such as numpy.