Semordnilap

From Esolang
Jump to navigation Jump to search

Semordnilap is a reversible joke language. It was discovered by User:Orby during February of 2019.

Introduction

A semordnilap is a word which spells another word when written backwards. Examples in English include paws and swap, and debut and tubed. Semordnilap is also reversible programming language. It is similar to Reversible Bitfuck with some minor modifications. The Semordnilap programming language fulfills two purposes: 1. Semordnilap source code consists entirely of English words, and any program which generates a sufficient amount Semordnilap code qualifies for National Novel Generation Month. 2. Semordnilap programs which halt may be reversed by performing a string reversal on their source code. This is the nifty property from whence Semordnilap derives its name.

Specification

Semordnilap is a language for tape machines with one bit cells. Semordnilap consists of five reserved keywords and a branching construct. All commands must be separated by white space, but white-space and non-alphabetic characters are ignored. The reserved keywords are

Command Description
retool Shift the tape head right
looter Shift the tape head left
oi Output the bit under the tape head
io Does nothing
tenet Toggle the bit under the tape head

Branching

Branches in Semordnilap are dual in nature. In reversible programming languages these are usually referred to as goto and comefrom. In Semordnilap we use the notation <label-name> and <label-name-reversed>. Any word that is not a reserved word is considered a label. For example

Command Description
deliver If the bit under the tape head is 1, then jump to the instruction after reviled
reviled If the bit under the tape head is 1, then jump to the instruction after deliver

The word deliver is not special in this context. Any semordnilap will fulfill the function of a label so long as it is not a palindrome. Notice that label pairs may be used similarly to brackets in Reversible Bitfuck. However, they are not restricted to this use; Semordnilap label pairs may be interleaved to produce more complex results. Neither labels nor reserved keywords are case-sensitive.

Examples

A Toffoli gate

 Tenet swap retool tenet deliver retool tenet looter reviled tenet looter paws tenet.

Notice it is a palindrome because it is self-dual. Here's "Hello, World!" done in the dumbest possible way

   Oi oi oi tenet oi tenet oi oi tenet oi tenet oi. Tenet oi tenet oi tenet oi
 tenet oi oi tenet oi oi tenet oi? Oi oi tenet; oi oi tenet oi tenet oi oi tenet
 oi. Oi oi tenet oi oi tenet oi tenet oi oi tenet oi. Tenet oi oi oi oi tenet oi
 tenet oi oi tenet oi. Oi oi, "Tenet oi oi tenet oi tenet oi tenet oi oi".
 
   Oi oi oi oi oi tenet oi tenet oi oi. Tenet oi oi oi tenet oi tenet oi tenet oi
 tenet oi tenet oi. Tenet oi, oi oi oi tenet oi! Tenet oi oi tenet oi. Oi tenet
 oi tenet oi oi tenet oi. Oi oi tenet oi, "Oi oi". "Tenet oi oi". Tenet oi,
 "Tenet oi oi tenet". "Oi!". Oi oi tenet. Oi tenet oi. Oi, tenet oi oi. Tenet oi.
 Tenet oi. Tenet oi. Oi oi oi Tenet oi. Tenet oi. Oi!

A nop

 Sator Arepo tenet opera rotas.

See also