0x29C

From Esolang
Jump to navigation Jump to search

0x29C is a variation of 0x29A. The commands are different. Another difference is the way the register works.

Commands:

  • Push a function to the stack: Any of the commands _|,.+-$ push that function to the stack (_ = k, | = s).
  • [x] creates a loop function containing x and pushes to stack. Loops can be nested.
  • {x} do commands x with a new stack (empty) and register (zero), and then pushes copy of top value of old stack to top of new stack. At the end, it reverts to old stack and register, and pushes a copy of the top value of the new stack to the top of the old stack (the entire new stack and new register are destroyed). These can be nested.
  • The % and ~ have the same function as 0x29A.

Pre-processor commands:

  • &name(value) = Creates a macro. Include ? anywhere in the value to use the parameter given to the macro. The name can use any printable ASCII characters other than &'();/* and white-spaces.
  • 'name(parameter) = Include a macro in the program.
  • 'name; = An abbreviation for 'name().
  • /* comment */ = A C-style comment.

Functions:

  • _(k) |(s) , . + - are same as 0x29A
  • (([x]y)z) = pop this function off of the stack, repeat commands in loop x until register is zero, and then push y to stack.
  • (($x)y) = pop this function off of the stack, then push x to the stack, and then push y to the stack.

Register: (The register stores values 0 or 1 or 2 only)

  • + changes 0 to 1, 1 to 0, 2 stays at 2.
  • - changes 0 to 2, 2 to 1, 1 to 0.
  • Input is done one bit at a time and the value is 0 or 1.
  • Output is one bit at a time. Trying to output 2 has no effects.

Examples:

  • Push identity function to stack = |_~|~
  • Discard top entry of stack = %_%~%~
  • Increment value of register = +%+%~%~
  • Duplicate top entry of stack = |$~|_~|~~%~
  • Set value of register to zero = [-%-%~%~]_~_~%_%~%~
  • Another identity function to stack = {%}