Staples

From Esolang
Jump to navigation Jump to search

Staples Esolang

Staples is a esoteric language to make Python just a little bit easier... by reducing the available characters to 4 and adding a checksum.

Staples can be installed through Python's package manager (Python 3.11 is required, so if you don't have it installed, install it!):

For MacOS and Linux, install it by running this command into your terminal:

pip3 install --user staples_lang --upgrade && \
if ! grep -qxF 'export PATH="$HOME/Library/Python/3.11/bin:$HOME/.local/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:$PATH"' ~/.zshrc; then \
  echo 'export PATH="$HOME/Library/Python/3.11/bin:$HOME/.local/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/opt/homebrew/bin:/usr/bin:$PATH"' >> ~/.zshrc; \
fi && source ~/.zshrc

For Windows, install it by running this in your powershell:

pip3 install staples_lang; 
$p='C:\Python311\Scripts'; 
if (Test-Path $p) { 
  if (-not ($env:Path.Split(';') -contains $p)) { 
    [Environment]::SetEnvironmentVariable('Path', $env:Path + ';' + $p, 'User'); 
    Write-Output "Added $p to User PATH. Restart your terminal." 
  } else { 
    Write-Output "$p is already in PATH." 
  } 
} else { 
  Write-Output "$p does not exist." 
}

Staples has a very strict syntax, and you can ONLY have four characters:

[ ] { }

Staples encodes Python code in a binary format, replacing the 0's with a hard bracket facing right and replacing the 1's with a curly bracket facing right. The code is then duplicated and mirrored, to create an artistic checksum.

Staples has a "Hello World" command too, like every other language.

[{{{[[[[[{{{[[{[[{{[{[[{[{{[{{{[[{{{[{[[[[{[{[[[[[{[[[{[[{[[{[[[[{{[[{[{[{{[{{[[[{{[{{[[[{{[{{{{[[{[[[[[[{[{[{{{[{{[{{{{[{{{[[{[[{{[{{[[[{{[[{[[[[{[[[{[[[{[{[[{}]]}]}]]]}]]]}]]]]}]]}}]]]}}]}}]]}]]}}}]}}}}]}}]}}}]}]}]]]]]]}]]}}}}]}}]]]}}]}}]]]}}]}}]}]}]]}}]]]]}]]}]]}]]]}]]]]]}]}]]]]}]}}}]]}}}]}}]}]]}]}}]]}]]}}}]]]]]}}}]

You can use your terminal to run Staples once you have downloaded it.

staples runfile <file_path>
staples compilefile <file_path>
staples runstring <staples_code_as_a_string>
staples compilestring <python_code_as_a_string>

Running a file/string runs the inputted raw staples code, and compiling a file/string converts Python to Staples.

Be careful though, do not add spaces, only add the right syntax characters and do NOT run code that you don't trust, because after all, Staples is just Python, but with a different syntax.

Theoretically, Staples is turing-complete due to the fact that it builds on top of Python, a turing-complete language.

Thanks for reading this, and I hope this makes Python 100% more fun to use. For more information, go here: https://github.com/SeafoodStudios/Staples