mirror of
https://github.com/Alvin-Zilverstand/sloppatron.git
synced 2026-03-07 05:53:06 +01:00
76 lines
2.3 KiB
Markdown
76 lines
2.3 KiB
Markdown
# BingBong 2.0
|
|
|
|
BingBong is a minimalist, esoteric programming language designed to be as simple and difficult to use as possible. This new version of BingBong is a binary representation of Python code.
|
|
|
|
## Language Elements
|
|
|
|
The BingBong language consists of only two commands:
|
|
|
|
* `.` (dot): Represents a `0` in the binary representation of the code.
|
|
* `,` (comma): Represents a `1` in the binary representation of the code.
|
|
|
|
## Execution Model
|
|
|
|
The interpreter reads the BingBong source code, converts the `.` and `,` characters to a binary string, decodes the binary string into a UTF-8 string, and then executes the resulting string as Python code.
|
|
|
|
**Warning:** The interpreter uses `exec()` to run the decoded Python code. This is a powerful but potentially dangerous function. Only run BingBong code from sources you trust.
|
|
|
|
## Interpreter
|
|
|
|
The language is interpreted by the `bingbong_interpreter.py` script.
|
|
|
|
### Usage
|
|
|
|
To run a BingBong program, execute the interpreter from your command line and pass the path to your source file as an argument:
|
|
|
|
```bash
|
|
python bingbong_interpreter.py your_program.bb
|
|
```
|
|
|
|
## Converter
|
|
|
|
A helper script, `py_to_bingbong.py`, is provided to convert standard Python code into the BingBong format.
|
|
|
|
### Usage
|
|
|
|
To convert a Python file (`.py`) to a BingBong file (`.bb`), run the following command:
|
|
|
|
```bash
|
|
python py_to_bingbong.py your_python_script.py
|
|
```
|
|
|
|
This will create a new file with the same name but with the `.bb` extension.
|
|
|
|
### Example Workflow
|
|
|
|
1. Create a Python file named `hello.py` with the following content:
|
|
|
|
```python
|
|
print("Hello, BingBong 2.0!")
|
|
```
|
|
|
|
2. Convert it to a BingBong file:
|
|
|
|
```bash
|
|
python py_to_bingbong.py hello.py
|
|
```
|
|
|
|
3. This will generate a `hello.bb` file with a long sequence of `.` and `,` characters.
|
|
|
|
4. Run the BingBong file:
|
|
|
|
```bash
|
|
python bingbong_interpreter.py hello.bb
|
|
```
|
|
|
|
5. The output will be:
|
|
|
|
```
|
|
--- Executing Decoded Python Code ---
|
|
Hello, BingBong 2.0!
|
|
--- Execution Finished ---
|
|
```
|
|
|
|
## Philosophy
|
|
|
|
The design philosophy of BingBong is to explore the limits of simplicity in programming language design, while intentionally creating a cumbersome and difficult-to-master tool. It serves as a thought experiment and a challenge for programmers who enjoy working with esoteric languages. |