Skip to content

raffimolero/rieasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rieasm

A program that converts .rie files into RLEs to paste into Golly.


Instructions
  1. make sure you have Golly and Rust installed.

  2. Clone this repo.

  3. Copy the contents of golly/Flow6.rule as text and paste it into Golly.

  4. Open up golly/Turing Machine.mc. It should look something like this:

    (Show Image)
    image
    The Flow6 Turing Machine.

  5. Go back to your terminal and type cargo run program --clip. This will first compile the rieasm assembler, which will then run, compiling the program.rie file found in this repository into your clipboard. (This is outdated btw there's a lua script somewhere that will compile the rieasm into your clipboard and paste it in the proper location automatically)

    (Show Image)
    image
    Terminal should look something like this after running the command.

  6. Go back to Golly, and follow these instructions to paste the RLE:

    (Show Image)
    image
    Hover and scroll to zoom. No need to hold any buttons.

    (Show Image)
    image
    Align your crosshair with the tile marked with green. It should say XY=0 0 on the top bar.
    Once the cursor is aligned, hit Ctrl+V and left click.

  7. Set the step size. Press the + and - keys on your keyboard until it's the right speed.

    (Show Image)
    image
    I recommend 8^0 if you want to track the exact paths of the signals.
    8^1 if you want to see individual register operations.
    8^2 if you want to see what the whole program does.

  8. Run the simulation by clicking the Green Play button on the top left.

    (Show Image)
    image
    image
    The red button will pause the simulation, while the blue button will reset it.


File format Lines of code are just tabs followed by tokens. It's pretty much like a `.csv` file but with tabs instead of commas.

If a line doesn't begin with a tab, it is a comment.

example comment:

cheese elephant

A tab width of 8 is recommended, but feel free to use tab width 4 if you like working with badly aligned instructions, or spaces if you want the program to refuse to compile :v


Note: For display consistency, I will be using spaces in the code.

The first real line of .rie code inside of the file is a header and must look like this:

        state   arg     goto    read    reg     reg     reg

with 0 or more reg columns. In this case, 3. The number of reg columns will specify how many registers the target Turing Machine model has.

The provided Turing Machine file has exactly 4 bits of state and 3 registers, so unless you know how to mod the machine, keep it at 3 registers.

As mentioned earlier for all .rie code, every token is preceded with tabs, as in <tab>state<tab>arg<tab>goto<tab>read and so on.

Every valid line after the header must now stick to the format specified by the header:

  • state is required. It must be a nonnegative integer, and is what goto looks for when jumping to the next instruction.
  • arg is also required. It is always paired with state, and is where read and reg '?' go to when finding the next instruction.
  • goto jumps to the corresponding state after the current instruction finishes. defaults to the same value as state.
  • read acts as if a register read a bit and returned true or false.
  • reg instructions may either be omitted, or one of the following:
    • > Push register head one step to the right.
    • < Pull register head one step to the left.
    • % Flip the bit at the register head.
    • %< Executes % then <. This is the only "combination" of instructions.[1]
    • ? Reads the bit at the register head. This will become the next arg.
  • anything after the last reg is a comment.

There may only be at most one read. Having no reads will end the program.

Notes

[1] Actually, %< is the more basic instruction. It just so happens that the register "drivers" allow chaining %< together with >, making %<> which is just %.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published