Skip to content

Instantly share code, notes, and snippets.

@schas002
Created April 16, 2016 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schas002/2f027462cc3d8ac1678129a5f7231976 to your computer and use it in GitHub Desktop.
Save schas002/2f027462cc3d8ac1678129a5f7231976 to your computer and use it in GitHub Desktop.
Obviously, an esoteric language.

Obviously

An esoteric language inspired by Seriously.

Syntax

Instructions are single words, either space or newline separated.

Notes

There are 4 data types in Obviously, numbers, strings, arrays and blocks.

N represents any value. This usually means numbers, but can represent any value of a type not specified in an alternate command definition.

S represents a string.

A represents an array.

i represents a complex value. Complex values are a proper subset of numbers.

B represents a block.

Instructions

  • input: read value from stdin and push

  • print: pop N: write N to stdout

  • 0: push 0

  • drop: pop N: discard

  • increment: pop N: push N+1

  • decrement: pop N: push N-1

  • plus: pop N,N2: push N+N2

  • subtract: pop N,N2: push N-N2

  • times: pop N,N2: push N*N2

  • divide: pop N,N2: push N/N2 (float division)

  • dup: pop N: push N,N

  • swap: pop N,N2: push N,N2 (rotate top 2 elements)

  • roll: rotates stack right by 1

  • save: pop N,N2: push N2 to register N

  • savezro: pop N: save N in register 0

  • saveone: pop N: save N in register 1

  • load: pop N: push the value in register N

  • loadzro: push the value in register 0

  • loadone: push the value in register 1

  • if: pop N,N2,N3: push N2 if N is truthy, else push N3

  • while: start loop: peek top of stack, repeat code in loop while a evaluates to true

  • wend: end loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment