We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Phena

From Esolang
Jump to navigation Jump to search

Phena is a programming language where each program is meant to look like an English-like sentence.

Syllables

Variables

Variables start with nasals. The variables are na, nae, ne, nea, nei, neo, no, nou, nu, ny, ma, mae, me, mea, mei, meo, mo, mou, mu, my. They can be printed, incremented, decremented, or set to input.

Syntax

An Extended Backus-Naur Form (EBNF) description of the language shall be adduced:

sentence       := padding , [ firstCommand , { commandTail } ] , padding , "." , padding ;
loopStart      := "Pa" , loopBody , thoInside ;
loopInside     := "pa" , loopBody , thoInside ;
loopBody       := commandTail ;
firstCommand   := startCommand ;
commandTail    := separator , innerCommand ,  { separator , innerCommand } ;
startCommand   := pheStart
               |  iStart
               |  jeiStart
               |  shaStart
               |  hoStart
               |  loopStart
               ;
innerCommand   := pheInside
               |  iInside
               |  jeiInside
               |  shaInside
               |  hoInside
               |  loopInside
               ;
pheStart       := "Phe" , variableInside ;
pheInside      := "phe" , variableInside ;
iStart         := "I" , variableInside ;
iInside        := "i" , variableInside ;
jeiStart       := "Jei" , variableInside ;
jeiInside      := "jei" , variableInside ;
shaStart       := "Sha" , variableInside ;
shaInside      := "sha" , variableInside ;
hoStart        := variableStart  , "ho" ;
hoInside       := variableInside , "ho" ;
teStart        := "Te" ;
teInside       := "te" ;
paStart        := "Pa" ;
paInside       := "pa" ;
thoInside      := "tho" ;
variableStart  := "Ma" | "Mae" | "Me" | "Mea" | "Mei" | "Meo" | "Mo" | "Mou" | "Mu" | "My" | "Na" | "Nae" | "Ne" | "Nea" | "Nei" | "Neo" | "No" | "Nou" | "Nu" | "Ny" ;
variableInside := "ma" | "mae" | "me" | "mea" | "mei" | "meo" | "mo" | "mou" | "mu" | "my" | "na" | "nae" | "ne" | "nea" | "nei" | "neo" | "no" | "nou" | "nu" | "ny" ;
padding        := { whitespace } ;
separator      := whitespace , { whitespace } ;
whitespace     := " " | "\n" | "\t" ;

Commands

Command Description
Phe__ Prints the value of the variable __. If the content constitutes a string, it is displayed verbatim; for a numeric content the ASCII character corresponding to the variable value is issued.
I__ Queries the standard input for an ASCII character and stores its character code in the variable __.
Jei__ Increments the value of the variable __ by one, wrapping around to zero if the upper bourne of 255 is transgressed. A variable comprehending a string datum is reset to the numeric state of zero prior to this operation's application.
Sha__ Decrements the value of the variable __ by one, wrapping around to 255 if the lower bourne of 0 is violated. A variable comprehending a string datum is reset to the numeric state of zero prior to this operation's application.
__ho Stores the string Hello World in the variable __.
Pa If the value of the variable nu equals zero, jumps forward to the corresponding Tho command; otherwise proceeds as usual. The case of nu holding a string object is tantamount to a non-zero value.
Tho If the value of the variable nu does not equal zero, jumps back to the corresponding Pa command; otherwise proceeds as usual. The case of nu holding a string object is tantamount to a non-zero value.
Te Immediately terminates the program.

Examples

Hello World

Neho phene.

ASCII Loop

This program repeatedly prints all ASCII characters, never to terminate:

Jeinu pa jeineo pheneo tho.

Cat program

This cat program repeats until a null character input is issued.

Inu pa phenu inu tho.

Truth-machine

A truth-machine is implemented in the following:

Inu
shanu shanu shanu shanu shanu shanu shanu shanu
shanu shanu shanu shanu shanu shanu shanu shanu
shanu shanu shanu shanu shanu shanu shanu shanu
shanu shanu shanu shanu shanu shanu shanu shanu
shanu shanu shanu shanu shanu shanu shanu shanu
shanu shanu shanu shanu shanu shanu shanu shanu
jeina jeina jeina jeina jeina jeina jeina jeina
jeina jeina jeina jeina jeina jeina jeina jeina
jeina jeina jeina jeina jeina jeina jeina jeina
jeina jeina jeina jeina jeina jeina jeina jeina
jeina jeina jeina jeina jeina jeina jeina jeina
jeina jeina jeina jeina jeina jeina jeina jeina
jeina
pa phena tho
shana phena.

Pronunciation

Pronounce it how you think its pronounced. Although if you are a bit of a rule follower...

Term Role Pronunciation
ho instruction /hoʊ/
i instruction /ɪ/
jei instruction /dʒeɪ/
ma variable /mæ/
mae variable /meɪ/
me variable /mi/
mea variable unknown
mei variable unknown
meo variable /mijoʊ/
mo variable /moʊ/
mou variable /moʊ/
mu variable /mu/
my variable /mi/
na variable /næ/
nae variable /neɪ/
ne variable /ni/
nea variable unknown
nei variable unknown
neo variable /nijoʊ/
no variable /noʊ/
nou variable /noʊ/
nu variable /nu/
ny variable /ni/
pa instruction /pa/
phe instruction /fi/
sha instruction /ʃa/
te instruction /tɜ/
tho instruction /θoʊ/

Interpreter

  • Common Lisp implementation of the Phena programming language. Please note that the concrete character set deployed constitutes a dependency on the Common Lisp implementation; in corollary, Unicode support may or may not be a feature incorporated in the personal environment. The interpreter at hand has been developed and tested with Steel Bank Common Lisp (SBCL) version 1.1.4 as part of the Lisp Cabinet 0.3.5 bundle.