Phone call

From Esolang
Jump to navigation Jump to search

Phone call is a minimalist programming language created by User:A that uses the character set possible to enter in a phone call.

These characters are enterable (please click to navigate to the respective command):

1 2 3
4 5 6
7 8 9
* 0 #

Commands

Command Description
0 Pushes 0 unto the stack.
1 Pushes -1 unto the stack.
2 Pushes 2 unto the stack.
3 Pushes 3 unto the stack.
4 Pushes 5 unto the stack.
5 Pushes 7 unto the stack.
6 Pushes 11 unto the stack.
7 Pushes 13 unto the stack.
8 Pops the stack.
9 Copies the top of the stack to the accumulator.
* Pops the two top stack elements, multiplies them, and pushes their product unto the stack.
# Detects the value of the accumulator:
  • If the accumulator value acc is even, jumps to the character at the one-based code position p that satisfies: p = acc / 2 + 1.
  • If the accumulator value is odd, repeats the subsequent instructions until the top of the stack equals 0.

Examples

Powers of Two

This program infinitely generates at the stack's top the powers of two, jumping in the code by mediation of the accumulator.

22*298#

Loop

This program pushes the elements 0, 3, 5, 7, 11 and 13 unto the stack, and repeated pops from the stack until the value 0 reappears at the top.

0345679#8

Interpreter

  • Common Lisp implementation of the Phone call programming language.