[go: up one dir, main page]

Skip to content

aauger/Rhue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rhue

(pronounced /ro͞o/)

A simple Rust thue interpreter, with some twists -- written as an excuse to explore Rust 2021 while learning with the Rust book and Rust By Example.

Usage

Unlike a typical Thue interpreter, Rhue uses two separate files. One file contains the rule text (.rhule), and a second file contains the starting program text (.rhue).

An example can be found in examples/binary_incrementer.

Rhue can be run from the built executable, or via cargo, in the following fashion:

cargo run ./examples/binary_incrementer/ruleset.rhule ./examples/binary_incrementer/program.rhue

Rule constructions

Like any other Thue interpreter, there are three basic rules you can leverage:

  • Replace (::=): replace the occurence of the lhs with the rhs.
  • Input (::=:::): replace the occurrence of the lhs with the user's input, with the rhs being the prompt.
  • Print (::=~): replace the occurrence of the lhs with empty string, and display the message on the rhs.