Code Monkey home page Code Monkey logo

folders.py's Introduction

Folders.py

Folders.py

A deep folders zoom

Folders is an esoteric programming language, created by Daniel Temkin in 2015, which encodes the program entirely into the directory structure.

All names of the folders as well as their contents are completely ignored. Instead, the commands are encoded in the nesting of folders within folders.

Let me say that again: THE SOURCE CODE IS THE DIRECTORY STRUCTURE. Lol.

This is a Python implementation of Folders for all to enjoy!

Folders is (was originally) implemented in C#.

Usage

Install from pip

Simply install the Folders command line interpreter

pip install Folders

Give the folder of the program you wish to run as an command line argument

Folders sample_programs/HelloWorld
# => Hello, World!

If instead you would like list the Python code to stdout, use the -l option

Folders -l sample_programs/HelloWorld
# => print("Hello, World!", end='', flush=True)

Run python

The implementation is just the python file, folders.py and has no dependencies, so if you'd like you can clone the repo and run python ./folders/folders.py instead of pip installing and use it the same as in the examples above.

Language details

The language details are on the esolangs wiki, but I've put it here for reference.

For example, take a look at the Fibonacci sample program.

The root folder contains a list of command folders - in this case labelled Nf1.., Nf2.., but the names don't actually matter except the alphabetical ordering - the first folder (which I've labelled with an init) is the first "sub-folder", the next is the second, etc.

Commands:

Commands take the following form

Command # of folders Details
if 0 folders Second sub-folder holds expression, third holds list of commands
while 1 folder Second sub-folder holds expression, third holds list of commands
declare 2 folders Second sub-folder holds type, third holds var name (in number of folders, ex. zero folders becomes "var_0")
let 3 folders Second sub-folder hold variable name (in number of folders), third holds an expression
print 4 folders Second sub-folder holds expression
input 5 folders Second sub-folder holds variable name

Expressions:

Expression folders take the following form:

Type # of folders Details
Variable 0 folders Second sub-folder holds variable name
Add 1 folder Second sub-folder holds the first expression to add, third holds second expression
Subtract 2 folders Second sub-folder holds the first expression to subtract, third holds second expression
Multiply 3 folders Second sub-folder holds the first expression to multiply, third holds second expression
Divide 4 folders Second sub-folder holds the first expression to divide, third holds second expression
Literal Value 5 folders Second sub-folder holds the type of the value (as described by types below, ex. two folders for a string)
Equal To 6 folders Second and third folders hold expressions to compare
Greater Than 7 folders Second and third folders hold expressions to compare (takes the form : second folder > third folder)

Types

And finally type folders take the following form:

Type # of folders
int 0 folders
float 1 folder
string 2 folders
char 3 folders

Note on this implemementation

The int, float, and char types are 8-bit only. But, you can add into their variables to arbitrary length, so to get a very large number you can simply multiply it a bunch of times.

This is what the fibonacci program does.

The absolute power of folders

Behold, the mighty Truth Machine program:

truth_machie

A mighty meme-worthy point

All Folders programs are 0 bytes if you're on windows as it interprets an empty folder as 0 bytes.

The ultimate code golf!

Links

folders.py's People

Contributors

georgewoodall82 avatar sinakhalili avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

folders.py's Issues

more features

folders is an epic programming language already so why not make it better?
suggestion - make a v2 or just build onto the existing version where there are more commands and expressions
examples - boolean data type, logic expressions (and/or/not), else/elif, etc.

Why no no work

i typed "Folders helloworld"

Traceback (most recent call last):
  File "C:\Users\jerem\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\jerem\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\jerem\AppData\Local\Programs\Python\Python39\Scripts\Folders.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'folders'

I just found out a bug

If you type your program named "Hello, World!" then the "Folders [-l] <Folder's name>" will not work

It will say: "Folders: error: unrecognized arguments: World!

Picture will maybe make everything clearer

@SinaKhalili @georgewoodall82
Capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.