A Question of Protocol

From Esolang
Jump to navigation Jump to search

A Question of Protocol is a esolang created by User:Yayimhere where its all just substacks, n' more substacks, yea stacks are very use full when nested for some reason

syntax

these are the commands:

  • $x: pop top of stack. if empty goto line x
  • #: push substack to stack
  • }: move the top of the stack to the bottom of the stack and { rotates the other way
  • =: push a sub-substack to the top substack of the stack
  • (x): = but with nesting x
  • (x[y]): !y but with nesting x
  • !x: pop the top of the top substack. if empty goto line x
  • *: run top of stack as a macro also popping it
  • h: halt
  • %: duplicate top of stack
  • ^: print top of stack as an ascii char(see ints) also popping it
  • ?: print but user INPUT

all nesting values start at the outermost stack(just the stack) has a value of 0

macros

(here i will be using python's list format where the end of the list is the front of the stack)
this is the structure(in a substack):

[[[cmd1][[arg1][arg2]...]][[cmd2][[arg1][arg2]...]]]

where each cmd i run in order.
here numbers are represented with how many stacks there are in a substack. so for 5 it would be [][][][][]. here are the commands:

  • $x: cmd(nesting number): 2, arg1: x
  • #: cmd: 1
  • }: cmd: 3
  • }: cmd: 5
  • =: cmd: 7
  • (x): cmd: 4, arg1: x
  • (x[y]): cmd: 6, arg1: x, arg2: y
  • !x: cmd: 8, arg1: x
  • *: cmd: 9
  • h: cmd: 11
  • %: cmd: 13

computational class

A Question of Protocol is turing complete since it can simulate a Minsky machine:

  • the code must start with ##
  • } to swap between registers
  • !x to decrement. if at 0 will go to x
  • = to increment

ints

ints can be represented like this:

  • lets say we have int n
  • as a substack with n many lists in it
  • now we have a integer

example

Infinite loop:

$0

or using macros:

#=(3)(3)(3)(3)(3)(3)(3)(3)(3)=(3)(3)(3)(3)(3)(3)(3)%*

which creates macro:

%*