Skip to content
/ gratie Public

A Rust-based interpreter for Gratie, my esoteric programming language based on Piet

License

Notifications You must be signed in to change notification settings

grkw/gratie

Repository files navigation

Gratie ("grah-tee")

License Version 1.0.0

My version of the Piet programming language. Made in collaboration with Jordan during the first half of the W1'24 batch at the Recurse Center.

(Piet Mondrian was a Dutch artist. According to Google Translate, "gratie" is Dutch for "grace"!)

Design

I designed Gratie to be a minimalist version of Piet while retaining its esoteric-ness. The main components of the interpreter are the parser (parses the text-based input program), grid (stores the parsed input as a grid of Colors), and stack (stores the values of the program). We put all the pieces together with the program execution logic in interpreter.rs.

Usage

To write your own Gratie program:

  1. Specify pixel colors in a comma-separated text file. These are the colors:

drawing

and this is the mapping from hue change steps to command:
Hue change steps Command
1 add
2 multiply
3 pop
4 in(char)
5 out(number)
6 duplicate
7 out(char)
8 in(number)
9 push
10 divide
11 subtract
  1. Run cargo build && ./target/debug/gratie -d PATH/TO/YOUR_PROGRAM.txt to run the repl. Currently, the available commands are step (execute one command) and run (run entire program and print result).

Examples

Push 3 onto the stack

drawing

Print 7 to the console

drawing

Acknowledgements

Helpful resources on how Piet works

License

Gratie is licensed under the MIT License Copyright (c) 2025.

See the LICENSE for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.

All trademarks referenced herein are property of their respective holders.

About

A Rust-based interpreter for Gratie, my esoteric programming language based on Piet

Topics

Resources

License

Stars

Watchers

Forks

Languages