Skip to content

rphle/tzap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tzap

tzap is a minimal, esoteric, queue-based programming language with only four instructions.

The instruction pointer continuously loops over the program while operating on a single FIFO (First-In, First-Out) queue of integers.

Access the live playground here.

Instructions

Token Name Description
0 Push Zero Push 0 onto the back of the queue
+ Increment Increment the last element; push 1 if queue is empty
~ Deque & Skip Remove the front element from the queue. If the value is greater than 0, push (value - 1) to the back of the queue and skip the next instruction. If the value is 0, discard it.
* Copy Copy front value to back of queue

Halting Condition

Execution halts when a ~ instruction attempts to skip past the exact end of the program sequence. In other words, the program stops only when a skip would move the instruction pointer beyond the final token instead of wrapping around.

Example

To add two numbers together, initialize the queue with the two addends (e.g., Initial queue: 5, 3) and run the following program:

~~++~~

This decrements the first counter while incrementing the second until the first counter hits 0 and is discarded, leaving the final sum in the queue.

Development

This project contains a Rust interpreter and a React frontend powered by WebAssembly.

Run make wasm to compile the Rust codebase to WASM, make webdev to start the local development server, and make web to build the production version of the frontend.

About

A minimal queue-based language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors