Created by: Seigh-sword
Repository: https://github.com/Seigh-sword/Prizm
License: Prizm License (Free Forever)
Prizm is a beginner-friendly programming language designed to make coding simple and approachable. The language emphasizes clarity, creativity, and practical power - perfect for those new to programming and developers who want efficiency.
File Extension: .pzm
Main Entry Point: center.pzm
Current Version: 0.1.0
Prizm comes with zero external dependencies. Download, run, and code immediately.
# One-line install (auto-detects OS & architecture)
curl -fsSL https://raw.githubusercontent.com/Seigh-sword/Prizm/main/install.sh | bash
# Reload shell
source ~/.bashrc # or ~/.zshrc for macOS
# PowerShell (as Administrator)
irm https://raw.githubusercontent.com/Seigh-sword/Prizm/main/install.bat | iex
# Reopen PowerShell after installation
prizm --version
# Output: Prizm v0.1.0
# Initialize a new project
./init.sh myapp # Linux/macOS
# OR
init.bat myapp # Windows
# Navigate to project
cd myapp
# Run it
prizm run
See QUICKSTART.md for detailed guidance.
These functions are always available at the top level without needing a header. The compiler automatically uses them when called:
output("text") - Print text with newlineprint("text") - Print text without newlineAll other functionality is organized in headers. The system only loads the header you request along with its specific attributes. The compiler doesn’t process the entire codebase; it only loads what you need.
Example:
math.random(1-10),
mathrandomPrizm supports strong typing with the following data types:
var age: int = 25,
var height: float = 5.9,
var name: string = "Alice",
var isActive: boolean = true,
var numbers: array = [1, 2, 3, 4, 5],
var person: object = {name: "Bob", age: 30},
Supported Types:
int - Integer numbersfloat - Floating-point numbersstring - Text stringsboolean - true or falsearray - Collections of valuesobject - Key-value pairsnull - Null/empty valueany - Any type (dynamic)file)file.create(path) - Create a new filefile.delete(path) - Delete a filefile.move(from, to) - Move or rename a filefile.replace(path, old, new) - Replace content in a filefile.modify(path, content) - Modify file contentfile.access(path) - Read and access file contentmath)math.add(a, b) - Additionmath.subtract(a, b) - Subtractionmath.multiply(a, b) - Multiplicationmath.divide(a, b) - Divisionmath.modulo(a, b) - Modulo operationmath.random(min-max) - Generate random numbermath.power(base, exp) - Power operationcontrol)if (condition) {
// code
} else {
// code
},
if (condition1) {
// code
} else if (condition2) {
// code
},
loop until (condition) {
// code
},
repeat for (i = 1 to 10) {
// code
},
var)var name = value,name = new_value,var x = name,function)define function_name(param1, param2) {
// code
return result,
},
function_name(arg1, arg2),http)http.get(url) - GET requesthttp.post(url, data) - POST requesthttp.put(url, data) - PUT requesthttp.delete(url) - DELETE requesthttp.header(key, value) - Set HTTP headerui)Create interactive windows and handle user interactions.
UI Elements:
ui.window(title, width, height) - Create a windowui.button(label, x, y, width, height) - Create a buttonui.text(content, x, y) - Display textui.input(placeholder, x, y, width, height) - Create text input fieldui.label(text, x, y) - Create a labelui.panel(x, y, width, height) - Create a panelui.render() - Render the UIEvent Handling:
ui.event(type, callback) - Listen for events and trigger callbacks when they happenButton Click Example:
# Create a window
ui.window("My App", 400, 300),
# Create a button
ui.button("Click Me", 100, 100, 150, 40),
# Handle click event
ui.event("click", handle_button_click),
# Define callback function
define handle_button_click() {
output("Button was clicked!"),
var result: int = math.add(5, 3),
output("5 + 3 = " + result),
}
# Render everything
ui.render(),
Interactive Form Example:
# Create interactive form
ui.window("Login Form", 500, 400),
ui.label("Username:", 50, 50),
ui.input("Enter username", 50, 80, 300, 30),
ui.label("Password:", 50, 130),
ui.input("Enter password", 50, 160, 300, 30),
ui.button("Login", 100, 230, 100, 40),
ui.button("Cancel", 250, 230, 100, 40),
# Click handlers
ui.event("click", on_login_click),
ui.event("click", on_cancel_click),
define on_login_click() {
output("Login attempt started..."),
time.sleep(1000),
output("Login successful!"),
}
define on_cancel_click() {
output("User cancelled login"),
}
ui.render(),
root) - Super Powerful OperationsThe root header provides low-level system access and advanced operations:
root.exec(command) - Execute system commandroot.system(instruction) - Direct system instructionroot.memory(address, value) - Access/modify memoryroot.process(pid, action) - Control processesroot.interrupt(signal) - Send interrupt signalroot.optimize(code) - Optimize code/performancedata) - Prizm JSON FormatPrizm has its own JSON format that works seamlessly with variables:
var config: object = {
name: "App",
version: "1.0.0",
features: ["login", "dashboard", "settings"],
debug: true,
},
// Encode to JSON string
var json_str = data.stringify(config),
// Parse JSON string
var parsed = data.parse(json_str),
// Validate JSON structure
var is_valid = data.validate(config),
// Merge objects
var merged = data.merge(config, other_config),
time)time.now() - Get current time/timestamptime.sleep(milliseconds) - Pause executiontime.format(timestamp, format) - Format time as stringtime.parse(string, format) - Parse string to timestamptime.timer(duration) - Create a timertime.timestamp() - Get Unix timestampEach header and attribute is assigned a unique ID for Assembly integration:
# Run a Prizm file
prizm run [filename.pzm]
# Format/Pretty print a file
prizm pretty [filename.pzm]
# Lint and check for errors
prizm lint [filename.pzm]
// Number Guesser Game in Prizm
// Uses built-in output and math header
output("Welcome to the Number Guesser Game!"),
var secret: int = math.random(1-10),
var guess: int = 0,
var attempts: int = 0,
loop until (guess == secret) {
output("Guess a number between 1 and 10: "),
attempts = attempts + 1,
if (guess < secret) {
output("Too low! Try again."),
} else if (guess > secret) {
output("Too high! Try again."),
},
},
output("You guessed it in "),
output(attempts),
output(" attempts!"),
// Simple UI Application in Prizm
// Create main window
ui.window("My Prizm App", 1024, 768),
// Create UI elements
ui.label("Welcome to Prizm!", 50, 50),
ui.button("Click Here", 100, 100, 200, 50),
ui.input("Enter something...", 100, 200, 300, 40),
ui.text("This is a dynamic text element", 100, 300),
// Render the UI
ui.render(),
// Use data/JSON for app config
var app_config: object = {
theme: "dark",
language: "en",
autoSave: true,
},
var config_json = data.stringify(app_config),
output("App Config: "),
output(config_json),
├── README.md
├── build.sh (Linux/macOS build script)
├── build.bat (Windows build script)
├── assets/
│ └── logo.svg
├── source/
│ └── example.pzm
├── bin/ (Compiled output)
│ ├── release/ (Release binaries)
│ ├── debug/ (Debug binaries)
│ └── dll/ (Compiled DLL files)
├── build/
│ └── build.rs (Build configuration)
└── compiler/
├── Cargo.toml
├── compiler.asm
├── parser.asm
└── src/
├── main.rs (CLI executable)
├── lib.rs (DLL library)
├── cli.rs (Command utilities)
├── attributes.rs (Headers & ID system)
├── lexer.rs (Tokenizer with type support)
└── stdlib.rs (Built-in functions)
chmod +x build.sh
./build.sh
build.bat
cd compiler
cargo build --release
./target/release/prizm_compiler run ../source/example.pzm
After building, you’ll find:
/bin/release/*.bin): Compiled executable binaries/bin/dll/*.dll): Dynamic Link Libraries for use in other applications/bin/debug/): Debug symbols and intermediate filesWe welcome contributions, feedback, and creative Prizm projects!
Happy coding with Prizm!