From Esolang
Jump to navigation Jump to search

Triskaidekalogophilia is an esolang with only 9 commands that only allow string manipulation. The commands can add, delete or change characters within a string. The name derives from the words describing the love of the number 13 and the love of words.



Prints the value stored in Variable.


Saves a user-inputted string in Variable with the prompt coming from the variable Prompt.


Increases the ASCII value of the character at Index in Variable by 1. 127 becomes 0.


Removes the last character in Variable.


Adds a character with an ASCII value of 0 to the end of Variable.


Places the character in Variable at Index in Result.


Executes the next command if the two variables are equal. If not, that line is skipped.


Goes to the specified line.


Returns to the line after the last @ command. If there has already been a # command or no @ command the program returns to the beginning.

All numbers must be given in base-13 0-C, the case is irrelevant.


Cat program



This is the code for the interpreter written in Python 3.3:

 import time
 Commands = {}
 Variables = {}
 def INPUT(String):
     String = String.split(';',1)
     if String[1] in Variables:
         Variables[String[0]] = input(Variables[String[1]])
 def PRINT(String):
     if String in Variables:
 def SHIFT(String):
     String = String.split(';',1)
     if String[0] in Variables:
             if not String[1] in Variables:
                 Index = 0
                 Index = int(Variables[String[1]],13)
             Variables[String[0]] = list(Variables[String[0]])
             Value = ord(Variables[String[0]][Index])
             Value = (Value+1)%128
             Variables[String[0]][Index] = chr(Value)
             Variables[String[0]] = ''.join(Variables[String[0]])
         except ValueError:
 def DELCHAR(String):
     if not String in Variables:
         Variables[String] = ''
     Variables[String] = Variables[String][:-1]
 def ADDCHAR(String):
     if not String in Variables:
         Variables[String] = ''
     Variables[String] = list(Variables[String])
     Variables[String] = ''.join(Variables[String])
 def GETCHAR(String):
     String = String.split(';',2)
     if String[0] in Variables and String[1] in Variables:
             Index = int(Variables[String[1]],13)
             Variables[String[2]] = Variables[String[0]][Index]
         except ValueError:
 def EQUAL(String):
     global LineNumber
     String = String.split(';',1)
     if String[0] in Variables and String[1] in Variables:
         if Variables[String[0]] != Variables[String[1]]:
             LineNumber += 1
 def GOTO(String):
     global LineNumber
     global LastJump
     LastJump = LineNumber
     LineNumber = int(Variables[String],13)
 def RETURN(String):
     global LineNumber
     global LastJump
     LineNumber = LastJump
     LastJump = 0
 Commands[">"] = INPUT
 Commands["<"] = PRINT
 Commands["^"] = SHIFT
 Commands["*"] = DELCHAR
 Commands["+"] = ADDCHAR
 Commands["?"] = GETCHAR
 Commands["="] = EQUAL
 Commands["@"] = GOTO
 Commands["#"] = RETURN
 File = [Foo.replace('\n','') for Foo in open(input("File: ")).readlines()]
 global LineNumber
 global LastJump
 LineNumber = 0
 LastJump = 0
 while LineNumber < len(File):
     Line = File[LineNumber]
     for Command in Commands:
         if Command == Line[0]:
             Function = Commands[Command]
             Function = 'Comment'
     if Function != 'Comment':
     LineNumber += 1
 print('\n=== END ===')