Path Language

PATH is an EsotericProgrammingLanguage that combines the simplicity of BrainfuckLanguage with the fun of BefungeLanguage. It has the same memory model and memory-manipulating instructions as BrainfuckLanguage, but contains a few extra instructions that allow for two-dimensional control flow and thus executable AsciiArt.


Summary of the language from http://pathlang.sourceforge.net/

The PATH interpreter starts at the LAST "$" symbol it finds and starts heading right. Every time it encounters a valid instruction symbol, it executes it. When it encounters certain special symbols, it may turn in another direction. The interpreter keeps going until it reaches a "#" symbol. Here is a listing of all PATH instruction symbols:

 + - increment the current memory cell
 - - decrement the current memory cell
 } - go to the next memory cell
 { - go to the previous memory cell
 , - input an ascii character from stdin into the current memory cell
 . - output an ascii character from the current memory cell into stdout
 / - If going:
               right, turn up
               down, turn left
               left, turn down
               up, turn right
 \ - If going:
               right, turn down
               down, turn right
               left, turn up
               up, turn left
 ^ - if current memory cell is not equal to 0, turn up
 < - if current memory cell is not equal to 0, turn left
 > - if current memory cell is not equal to 0, turn right
 v - if current memory cell is not equal to 0, turn down
 ! - jump next symbol
 $ - start here heading right
 # - end here
 any other character including spaces - do nothing

Some interpreters additionally have ] and [ which unconditionally redirect control flow right and left respectively. However, the author of PATH has asked that the name "PATH" be reserved for his original version, and that variants are given names of their own.


The fact that the PATH instructions are not very orthogonal (there are four of them that does execution branching) disturbs some people. So to orthogonalize the instruction set, and to solve the problem of ambiguous semantics and the lack of fancier features such as modularity and concurrency in the process, SnuspLanguage was created.

There is also LnuspLanguage, which has only 5 commands: +*!?@. but the "." command doesn't do anything. It can go straight and diagonal. This was created to have fewer commands than BrainfuckLanguage but still do the same thing.


Here is a simple program that prints in decimal the ASCII value of the first character input from standard-in:

         /<+>>-v-v-v-v-\ wiki
 $>,!/> !\< v-v-v-v-v-v/
     \>+<v>>{+{+{+{+{+{\ wiki
      /<</\/.# }+}+}+}+/
  /< !\++++++++++++++++++++++++\ wiki
  \-v<.++++++++++++++++++++++++/
    \++++/\/

Note: This program does not work with current versions of PATH due to important changes in the language, most notably that the functionality of the { and } symbols has been switched around, and that the ^ v < > symbols now branch when the current cell is not equal to zero instead it is equal to zero. This program here should probably be updated to reflect this.


See also: BrainfuckLanguage BefungeLanguage SnuspLanguage LnuspLanguage QuineProgram


CategoryProgrammingLanguage


EditText of this page (last edited March 3, 2011) or FindPage with title or text search