Tiangou

From Esolang
Jump to navigation Jump to search

Tiangou is a derivative and wimpmode of Cerberus. It only has 1 line, which is a list of commands separated by spaces. All the commands correspond to one in Cerberus.

Commands

p | Push 1 to stack
q | Push -1 to stack
i | Push input to stack
o | Pop and print top of stack
- | Pop A and B, push A-B
! | Pop A. If positive, push A!, else push -((-A)!)
" | Swap top 2 items
: | Duplicate top item
< | Pop A, set current IP location as A-marker
> | Pop A, jump to A-marker (no-op if undefined)

Example program: Truth-machine

i p < : : o >

Translation to Cerberus

     ..-.--
p -> .---.-
     ..-.--
     ..-.--
q -> .-...-
     ..-.--
     ..-..--.-.---
i -> .---.--.--..-
     ..-..-.--...-
     .-...-
o -> ..-.--
     ..-.--
     .--.--
- -> .-...-
     .--.--
     ..-..-
! -> .---.-
     ..-..-
     ..-
" -> .--
     .--
     ..-..--.--.--
: -> .---.-..-...-
     ..-..-..--.--
     ...-.---.--.--
< -> .--...-..-...-
     ..---.-..--.--
     ..-..-.-----.-..--.--
> -> .---.--..-...-..-...-
     ..-..--...-.---.--.--