PushDupAddSub

From Esolang
Jump to navigation Jump to search

PushDupAddSub (PDAS) is an esolang by User:ChuckEsoteric08 inspired by Volatile.

Commands

1 - push 1
+ - pop a and b, push a+b
- - pop a and b, push b-a
/ - pop a and b, push b/a followed by remainder
: - duplicate
[...] - while 0 

Computational class

PDAS is Turing-complete because its behavior is capable of implementing the PMMN:

n should be prime number. P(n) would push n, when compiled to normal it uses 1, +, and :.

Initialisation:

1

inc(n):

: n-times, + n-times

dec(n):

P(n)/:-+

while(n):

:P(n)/[+ ... P(n)/]:-+

if(n):

:P(n)/[+ ... 11+]:-+

Examples

Addition and Subtraction

This program demonstrates basic arithmetic operations by setting the top stack value to five, and subsequently decrementing it to four:

11+1+1+1+::/-+

Infinite Counter

This program implements a counter which, commencing from zero, perpetually increments. During each loop iteration cycle's inchoation, the top stack element contains the current counter state.

11:1/-+
[+1+1:1/-+]

Interpreter

  • Common Lisp implementation of the PushDupAddSub programming language.