COBOLD

Specs

COBOLD (also known as YipYap) is an programming language for Kobolds.

COBOLD is primarily used in yipping and yapping.

Syntax

COBOLD programs MUST start with yip yap. Followed by a list of instructions separated by spaces.

Comments start with owo and continue until the end of the line.

Execution model

The COBOLD execution model consists of the following items:

Hold Register
hold
An unsigned 8-bit register used to perform most operations
Stack Memory
memory
An array of unsigned 8-bit integers that grows as needed, initialized with a single 0 value
Stack Pointer
stack
A register representing an index within Stack Memory. If this register grows past the end of the Stack Memory, new elements are allocated.
Stack Value
*stack
memory[stack]
The value in memory pointed by the Stack Pointer.

Instructions

Token Pseudocode Description
yip stack++ Increase stack position
yap stack-- Decrease stack position
yip? if (!hold) goto next yap! Jump after the next yip! if hold is zero
yap? hold = min(*stack, hold) Set hold to the stack value if it's less than hold
yip! hold -= *stack Subtract the stack value from hold
yap! goto prev yip? Jump to the previous yip?
Yip print(chr(hold)) Output hold as character
Yap hold += *stack Add stack value to hold
Yip! print(hold) Output hold as a number
Yap! return Returns from a function to its invocation
Yip? func() {} Defines a function whose name is the next token
Yap? func() Invoke the function represented by the next token
yipyip hold = *stack Assign the stack value to hold
yipyap swap(hold, *stack) Swap hold and stack value
yapyip hold++ Increase hold value by 1
yapyap hold-- Decrease hold value by 1

Playground

Here you can execute and debug COBOLD scripts. Note that since this is a debug view loading a program takes some time and execution is rather slow. For running the code faster, you should use the python script.

Initializing virtual machine, please wait...