Pyfun
Jump to navigation
Jump to search
Pyfun is a programming language in which only the following five characters are allowed
a [ ] + <
Pyfun is designed such that it can be easily converted into python 3. To convert pyfun code to python code, you have to replace the word code in the following python code with your pyfun code.
import sys a=[0] while True: a=code if a[0]==1: a[1]=ord(sys.stdin.read(1)) if a[0]==2: sys.stdout.write(chr(a[1])) sys.stdout.flush() if a[0]==3: break
For example, if the pyfun code is
[+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]
Then, the python code would be
import sys a=[0] while True: a=[+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]] if a[0]==1: a[1]=ord(sys.stdin.read(1)) if a[0]==2: sys.stdout.write(chr(a[1])) sys.stdout.flush() if a[0]==3: break
Examples
Hello World program
[[[[[]<[[]]][[]<[]]<<[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]]+[[]<[]]+[[]<[]]]+[[[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[[]<[[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]+[[]<[[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[]<[[]]][[]<[]]]]+[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]]+[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][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]<[[]]][[]<[]]]+[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]]+[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[[[[]<[[]]][[]<[]]<<[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]][[]<[]]+[[]<[[]]][[]<[]]<<[[]<[[]]][[]<[]]]+[[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]<<[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]][[]<[]]+[[]<[[]]][[]<[]]]]+[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]]][[]<[]][a[[[[]<[]]+[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]][[]<[]][[[]<[]][[]<[]]<a[[]<[]]]]]]][[]<[]][[[]<[]][[]<[]]<a[[]<[]]]
Cat program
[[[[]<[[]]]+[[]]]+[[[[]<[[]]][[]<[]]+[[]<[[]]][[]<[]]]+[a[[[[]<[]]+[[]<[[]]]][[]<[]][[[]<[]][[]<[]]<a[[]<[]]]]]]+[[[]<[[]]]+[[]]]][[]<[]][a[[]<[]]]
Computational class
Pyfun is turing complete as someone was able to write a program that converts brainfuck into Pyfun.