owoScript

From Esolang
Jump to navigation Jump to search
owoScript
Paradigm(s) imperative
Designed by Fiona1729
Appeared in 2019
Memory system stack with optional
Computational class Turing complete
Major implementations owoScript interpreter
File extension(s) .owo, .owop

owoScript is a esoteric programming language that has code comprising entirely of OwO faces. owoScript programs are usually written in a higher level description language, and then compiled into OwO "bytecode." owoScript is Turing complete via a reduction from Brainfuck. owoScript is still in development, so may be buggy or change frequently.

Language Overview

owoScript syntax and more frequently updated command list can be found at the official owoScript documentation. However, the basics of the language will be detailed here: owoScript consists of 4 types of statements: number literals, commands, while loops, and if statements.

Number literals consist of the keyword literal, lit, or l followed by a single hex digit:

 literal 4;
 literal b;

Commands are written with their specific keywords:

 mult;

While loops are written as:

 while {
   //statements or nop;
 }

If statements are written as:

 if {
   //statements or nop;
 } else {
   //statements or nop;
 }

While loops will observe the top value of the stack without changing it, and continue if it is not 0 If statements pop the top value of the stack and execute the first block if it is not 0, or the second if it is 0

Commands

Keyword Pops Pushes
literal x None hex value of x, x must be single hex digit (0-9, a-f)
add a, b a + b
sub a, b a - b
mult a, b a * b
div a, b a // b (floor division)
mod a, b a % b (modulus)
exp a, b a ^ b (exponent)
print a prints the character with code *a*
printnum a prints the number literally
printstack None prints entire stack
input None number of character read from stdin
inputnum None decimal number read from stdin
lt a, b 1 if a < b else 0
gt a, b 1 if a > b else 0
eq a, b 1 if a == b else 0
neq a, b 1 if a != b else 0
cmp a, b if a == b: 0, if a > b: 1, if a < b: -1
dupe a a, a (a repeated)
dupedeep a extend stack with last a values on stack
swap a, b b, a (top two values swapped)
push a, b puts a *b* layers deep in the stack
fetch a pulls the number *a* deep in the stack to the top
stacklength None length of stack
store a, b stores b in the *a* slot in the hashmap
get a pushes the value stored in *a* slot in the hashmap
stop a exits with return code a
fetchdupe a, b same as fetch but doesn't remove number from inside stack
pushdupe a same as push but doesn't remove number from top of stack
nop None no operation, used for code clarity in if/else statements
hexmult a, b a * 16 + b (hexadecimal digit appending)
printhash None prints entire hashmap

Turing completeness

owoScript is proven turing complete via a simple reduction from brainfuck. The owoScript repository also contains an optimizing transpiler capable of generating owoScript from brainfuck code.

Examples

Truth Machine

OwO <w< uwu nwn OwO ^w^ OwO uwu uwu nwn OwO ^w^ OwO UwU

Hello, World!

owo cwc owo CwC OwO xwx OwO ~w~ owo ~w~ owo ~w~ OwO xwx owo OwO OwO nwn OwO ~w~ owo XwX owo >w> owo uwu OwO nwn OwO xwx uwu nwn uwu nwn OwO ~w~ OwO ~w~ owo UwU owo xwx owo xwx OwO xwx owo OwO OwO nwn OwO xwx OwO ~w~ owo cwc owo nwn OwO xwx OwO ~w~ OwO ~w~ owo UwU owo xwx owo xwx OwO xwx owo OwO OwO nwn OwO xwx OwO ~w~ owo xwx owo >w> owo nwn OwO nwn OwO xwx OwO ~w~ owo CwC owo *w* OwO xwx OwO ~w~ owo ~w~ owo ~w~ OwO xwx OwO ~w~ owo CwC owo XwX OwO xwx OwO ~w~