Py2Folders
A partial-transpiler that converts a subset of Python to the Folders esoteric programming language
Folders
Folders is an esoteric programming language created by Daniel Temkin where the instructions are represented completely by the structure of folders. That is, there are NO FILES. The names of the folders and any files within are COMPLETELY IGNORED. For example, the Hello World of Folders can be found in this file and a simpler example of printing "h" is as follows (Yes, literals have to be encoded in hexidecimal encoded in folders).
py_tests/print_h/
└── 0 - F_PRINT
├── 00printdecl
│ ├── 0
│ ├── 1
│ ├── 2
│ └── 3
└── 01printexpr
├── 00litdecl
│ ├── 0
│ ├── 1
│ ├── 2
│ ├── 3
│ └── 4
├── 01littype
│ ├── 0
│ └── 1
└── 02litvalue
└── 0h
├── hexchar0
│ ├── 0
│ ├── 1
│ │ └── 1
│ ├── 2
│ │ └── 1
│ └── 3
└── hexchar1
├── 4
│ └── 1
├── 5
├── 6
└── 7
31 directories, 0 files
The Transpiler
Py2Folders transpiles a subset of Python's source code constructs into Folders "source code". Why I mention a subset is that not every Python construct can be directly translated. So, this begs a large question:
What's Allowed?
Statements:
- If
- While
- Single Assignment
- Printing a Single Expression
- Input
Expressions (May not be nested):
- Variable
- Add
- Subtract
- Multiply
- Divide
- Num and Str Literals
- Equals
- Greater Than
- Less Than
If your .py file adheres to these large restrictions, it can be transpiled.
Usage
- Clone this Repo
- Create your Python file to transpile
- Note: You must have a Python 3.10 installation to run the transpiler
- run
Python3 py2Folders.py
which will create a new directory - (Optional) Install Folders.py and run
Folders
Congrats! You have translated your Python source file to a construct of entirely folders that still runs.