Skip to content

Patrick-Poitras/write-only-wanguage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the write-only wanguage, or ‘wow’.

It is a language that prevents bugs by forbidding any input-output operations and side-effects. This includes only an interpreter, which does not read any files or command line input, and does not report data to the user.

In order to extract VC money, it is also to note that it is made with 100% safe rust. This means that there is a five order of magnitude increase in safety.

There’s a handy-dandy in-depth retrospective, available here. It’s probably a better starting point than this file. It will also be published as a post on my website, eventually.

Features!

Custom-built virtual machine with optimized instruction set

New virtual machine to complement the write-only model of computation.

General purpose programming language!

It’s equally unsuited for all applications!

Probably turing complete!

Wasn’t a design criterion, but might still work!

Over 2048 bytes of memory!

256 x 64-bit unsigned integers plus 2 registers

Integrates with gdb!

Official instructions

Compile the program with cargo build, then open the executable.

The executable had no way of reading any wanted inputs, so it will sit in an endless loop. This is the only endorsed mode of operation for the language.

Unofficial instructions

The interaction with the program requires writing registers with a debugger. This will void the warranty.

You will need rust and rust-gdb

Compile the program with cargo build, then open the executable with rust-gdb.

> rust-gdb target/debug/write-only

Put a breakpoint at the start of the loop.

(gdb) b 23

Then run the program and advance to the breakpoint.

(gdb) r
(gdb) c

Write your instruction into INS

(gdb) set INS.v.value = 0xA001

and then let the code execute the loop

(gdb) c 

The language does not allow you to read the output, but you can read the variables using gdb anyway.

(gdb) print ACC.v.value

and then write them down in a book somewhere.

Running a file

You can put gdb instructions into a file, and load it into gdb with

source example.wow

Complaints

I followed the official instructions and it didn’t produce any meaningful results

We only claimed it wouldn’t produce bugs, not that it would produce useful output. In fact, because it can’t produce any output at all, producing useful output would constitute a violation of the standard.

I encountered a bug while using the unofficial method

Because the method is unofficial, we are going to strictly assign the blame on you for any software defects. Despite this, feel free to file an issue so that others may laugh at your ineptitude.

Atomic values use unsafe on the backend, yet you claimed to not use unsafe

If you hide the unsafe beneath the carpet, it’s like it never existed.

I have a concern not addressed here

Please file an issue, and we will take great pleasure in telling you that you are wrong.

Instruction set

All instructions are conveniently named after its hexadecimal value.

Op codeEffect
0x0000Idle, wait 10ms
0xA000Zero Acc
0xA001Increment ACC
0xA002Decrement ACC
0xA01XLsh ACC by (X + 1)
0xA02XRsh ACC by (X + 1)
0xA030Bitwise NOT Acc
0xA1XXAdd *XX to ACC
0xA2XXSub *XX from ACC
0xA3XXMul *XX to ACC
0xA4XXDivide ACC by *XX, if the division has a remainder, write 0 to ACC.
0xA6XXBitwise AND ACC with *XX
0xA7XXBitwise XOR ACC with *XX
0xA8XXBitwise OR ACC with *XX
0xAAXXWrite ACC to memory XX
0xAB00Write ACC to all memory
0xBAXXSet INS to *XX
0xBBXXSet INS to *XX, Setup deferred jammer to set BA(XX+1)
0xBCXXSet INS to *XX, if (*XX & 0xFF0000) > 0, then setup deferred jammer to BXYY where YY is the value from the bitwise operation above.
0xC0XXIf ACC == 0 -> Set INS to *XX
0xC1XXIf ACC != 0 -> Set INS to *XX
0xC2XXIf ACC > *XX -> Set INS to *(XX+1) else *(XX+2)
0xC3XXIf ACC < *XX -> Set INS to *(XX+1) else *(XX+2)
0xFFFFExit

The race condition jammer is a thread that sleeps for 10ms and then writes a value to INS.

About

Towards a write-only model of computation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages