egglang-cli
v0.1.31
Published
Command-line runner for the Egg programming language π₯π£
Downloads
48
Maintainers
Readme
Egg π₯π£
Egg is a minimalist, whimsical programming language inspired by eggs and birds , designed to be simple, fun, and easy to extend.
Built for the VelociCode challenge, EggLang embraces the prehistoric spirit of the event by treating eggs not just as symbols, but as a full-blown design philosophy. From the syntax (
yolk,hatch,carton,crackup) to the underlying mechanics, every part of EggLang is inspired by birds, eggs, and evolutionary fun.Just like life hatching from an egg, every EggLang program begins with a humble
yolk(variable), evolves through control flow likeloopandshellmatch, and ends with a glorioushatch(output). It's a language that doesnβt just run , it evolves on your terminal, one π£ at a time.
Features
- Variables with
yolk(assignment) - Pattern matching with
shellmatch/case/default - Arrays called
cartonwith methods (append,pop,remove) - Control flow:
- Conditional blocks with
if/else/endif - Loops with
loop condition { ... }
- Conditional blocks with
- Functions definition and calls with
fun/crackupandlay - Built-in utilities (
random(),eggtime(),len(),type()) - File inclusion with
incubate filename.egg - Simple output via
hatch
Getting Started
Requirements
Python 3.x
Install it from python.org or use the instructions below.Mac:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install python python3 --versionWindows:
- Download from: https://www.python.org/downloads/windows/
- Run the installer and check βAdd Python to PATHβ
- Confirm installation:
python --version
Node.js (for the CLI and VSCode extension)
Get it from nodejs.org or install via terminal:Mac:
brew install node node -v npm -vWindows:
- Download the LTS version from https://nodejs.org/
- Run the installer (npm included)
- Confirm:
node -v npm -v
VS Code (to use the extension)
- Download from: https://code.visualstudio.com/
- Install relevant extensions from the Extensions Marketplace inside VS Code.
Run Egg Code
- Install the Egg CLI globally:
npm install -g egglang-cliThen run any .egg file:
egg run dino.eggEgg Language Syntax Examples
Variable Assignment
yolk x = 5
yolk greeting = "hello"Pattern Matching
yolk action = "crack"
shellmatch action
case "crack":
hatch "Breaking stuff"
case "hatch":
hatch "Output detected"
default:
hatch "Unknown behavior"
endshellArrays (carton)
# Traditional fixed-size array
carton nest 3
fill nest at 0 with 10
hatch nest at 0 # outputs: 10
# Dynamic array initialization
carton eggs = [1, 2, 3]
eggs.append(4) # [1, 2, 3, 4]
yolk first = eggs.pop() # removes 4
eggs.remove(0) # removes at index 0 β [2, 3]Control Flow
if-else blocks
yolk x = 10
if x > 5:
hatch "x is large"
else:
hatch "x is small"
endifLoops
yolk i = 0;
loop i < 5 {
yolk i = i + 1;
}Functions
Define a function:
crackup say_hello
hatch "Hello from Egg!"
layCall a function:
crackup say_helloBuilt-in Functions
random(a, b) - random int between a and b
eggtime() - current timestamp string
len(x) - length of string or list
type(x) - type name of value
File Inclusion
- Use incubate filename.egg to include and run another Egg file.
How It Works (Under the Hood)
The interpreter parses and executes Egg code line-by-line
Variables are stored in environments (yolk assigns values)
Arrays (carton) support:
Indexed access (at)
Dynamic methods (append, pop, remove)
Both fixed-size and dynamic initialization
Control flow:
if/else/endif blocks
loop condition { ... } constructs
Pattern matching uses shellmatch blocks
Functions are defined as named code blocks and called with crackup
Built-in EggTools functions extend language capabilities
Simple error handling prints fragile: messages
Example: Complete Egg Script
incubate utils.egg
# Array demo
carton eggs = [1, 2, 3];
eggs.append(4);
hatch len(eggs); # 4
yolk num1 = eggs.pop(); # removes 4
yolk num2 = eggs.remove(0); # removes at index 0 β [2, 3]
crackup add
crackup multiply
yolk num = 7
crackup is_even # prints "Odd"
# Loop demo
yolk i = 0;
loop i < len(eggs) {
hatch eggs at i
yolk i = i + 1
}
# Conditional demo
if len(eggs) > 2:
hatch "Plenty of eggs!"
else:
hatch "Need more eggs!"
endif
# Function demo
fun greet
hatch "Hello from an egg function!"
lay
crackup greetContributing
Contributions, bug reports, and feature requests are welcome!
Fork the repo
Create a new branch
Submit a pull request
Easter Egg - π₯ Eggspionage: Terminal Cam in ASCII
eggspionage- Make sure you have opencv-python and numpy installed.
- Make sure you have web cam access enabled for vscode.
- Make sure to resize the terminal for a better experience.
- Use the slider to scroll to the bottom for current camera frames.
- By default, the terminal cam will render in base black text mode.
- Here -c refers to color mode. Use one of r, g, b, m, d. r = red, g = green, b = blue, m = multicolor, d = dino mode π¦π₯.
Use VSCode terminal to run eggspionage for best experience.
Example:
eggspionage -c rFeatures:
πΈ Live webcam feed rendered in ASCII
π Optional color mode
β¨οΈ Cross-platform compatibility (macOS, Linux, Windows)
π§ Automatically scales to your terminal size
βοΈ Gracefully exits on Ctrl+C
Thanks for cracking open Egg! π₯π£
