PYSP

From Esolang
Jump to navigation Jump to search

PYSP (for PYthon String Programming) is a DSL embedded by an unknown user in Python, described as 'lisplike'. It seems to have been inspired by such languages as Parenthesis Hell.

Syntax

PYSP has two syntax modes. When USE_SAFE_SENTINEL mode is set, Ø represents nil and ( and ) are for function calls. When unset, ... is used for nil instead. Numbers are constructed by repeatedly calling nil with no arguments. ...() is 0, ...()() is 1, ...()()() 2, etc. Lists are constructed by calling nil repeatedly with one argument. ...(...) is [], ...(...)(a) is [a], ...(...)(a)(b) is [a, b], etc.

Semantics

Integers can only be zero or above. Calling such an integer allows indexing on a global tree-like data structure that stores predefined functions. 0 is the so called 'root', and 1 is the 'trunk'. Any higher numbers seem to be left for programmer use. 0 contains a tree of basic operations, accessed by calling 0 with a list of indices representing where in the tree the required function is. For example, calling 0 with a list [1, 5, etc seems to call the modulo function with the rest of the list, according to the specification (although the reference implementation instead defines it as exponentiation).

Origins

PYSP was first published in an anonymous entry in the inaugural Esoserver code guessing contest (continued from on the Esolangs Discord server). The contest revolves around making it difficult for participants to guess who wrote the code for your submission, so naturally the specification was just as unsigned as its integers.