Croisslang is a stupid programming language inspired by croissants. It allows you to create, manipulate, and combine "croissants" (binary data) and "bake" them through various operations.
- Define memory size using an "Oven."
- Create croissants (binary data) and store them in trays.
- Flip, combine, and manipulate trays of croissants.
- Serve trays of croissants after performing operations.
Before you begin, you must specify the memory size for your operations using the Oven
syntax:
Oven<8>
This defines that the memory size is 8 bits.
To create a croissant (a set of binary data), use the Prepare
keyword:
Prepare <1,0,1,1> into TrayA
This creates a binary croissant [1, 0, 1, 1]
and stores it in TrayA
.
You can combine two trays of croissants into a new tray:
Combine TrayA with TrayB into TrayC
This combines TrayA
and TrayB
and stores the result in TrayC
.
You can flip a croissant at a specific position using the Flip
keyword:
Flip TrayC at 2
This flips the bit at position 2
in TrayC
.
After performing operations, you can serve the final tray:
Serve TrayC
Here's an example .crois
file demonstrating the features:
Oven<8>
Prepare <1,0,1,1> into TrayA
Prepare <0,1,1,0> into TrayB
Combine TrayA with TrayB into TrayC
Flip TrayC at 2
Serve TrayC
To get started with Croisslang, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/croisslang.git cd croisslang
-
Install required dependencies:
pip install -r requirements.txt
-
Run the Croisslang script:
python croisslang.py ./examples/binary_add.crois
To run a .crois
file, use the CLI tool. Here is an example:
python croisslang.py ./examples/binary_add.crois
The script will parse and execute the Croisslang code, producing the desired operations on croissants and trays.
This example simulates adding two 4-bit binary numbers:
Oven<4>
Prepare <1,1,0,1> into TrayA # 13 in binary
Prepare <0,0,1,1> into TrayB # 3 in binary
Combine TrayA with TrayB into TrayC
Flip TrayC at 1
Serve TrayC
This example flips and combines multiple trays:
Oven<4>
Prepare <1,0,0,1> into TrayA
Prepare <1,1,0,0> into TrayB
Flip TrayA at 2
Combine TrayA with TrayB into TrayC
Serve TrayC