Skip to content

rolandbrake/piscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi-Script Logo

π Pi-Script

A lightweight, embeddable scripting language for creative coding.
Python-inspired • Written in C • Built for retro-style graphics

🌐 Website🎮 Playground📚 Documentation


✨ Overview

Pi-Script (Pixel Script) is a lightweight scripting language inspired by Python and implemented in C. It is designed for simplicity, performance, and creative experimentation within a 128×128 pixel virtual environment.

Pi-Script is ideal for:

  • 🎓 Educational use
  • 🎨 Creative coding
  • 🕹 Retro-style graphics experiments
  • 🌐 Embeddable web playgrounds
  • 🧩 Lightweight scripting integration in C projects

Pi-Script In Action

Piscript in action

Pi-Script makes it easy to create visual experiments, animations, and small interactive programs inside a retro-style virtual console.


🖥 Pi Shell

Pi Shell Demo

Pi Shell is the native desktop runtime environment for Pi-Script.

It provides a lightweight development workflow for running Pi-Script locally with:

  • 🧠 Interactive script execution
  • 📁 File-based project support
  • ⚡ Fast native performance
  • 🛠 Integrated graphics window
  • 🧩 Ideal for game development and experiments

Run scripts directly:

run <script-name>.pi

Pi Shell extends Pi-Script beyond the browser, turning it into a practical creative coding tool for real desktop development.


🐍 Pi-Script In Action — Snake Game

Snake Game in Pi-Script

A complete Snake game built entirely in Pi-Script.

This example demonstrates:

  • 🎮 Game loop implementation
  • 🕹 Keyboard input handling
  • 🧠 State management
  • 🎨 Real-time rendering with pixel() and draw()
  • ⚡ Smooth performance inside the 128×128 virtual console

The Snake game proves that Pi-Script is capable of building fully playable retro-style games with clean and minimal code.

Try it in (snake.px):

  • 🌐 Online Playground
  • 🖥 Pi Shell (native build)

🚀 Features

Language & Runtime

  • Clean, Python-like syntax
  • Custom virtual machine implemented in C
  • Variables, functions, and control flow
  • Functional programming utilities:
    • map
    • filter
    • reduce
    • compose
  • Matrix and vector operations:
    • dot
    • cross
    • multiply

Graphics

  • Fixed 128×128 virtual framebuffer
  • SDL2-powered rendering
  • Minimal and expressive graphics API:
    • clear()
    • pixel()
    • draw()
  • Palette-based color system
  • Built-in 3D rendering engine
  • .obj file support

Platform Support

  • Native builds (Linux, macOS, Windows)
  • WebAssembly support via Emscripten
  • Embeddable in web applications

📦 Getting Started

🔧 Requirements

  • C compiler (GCC or Clang)
  • SDL2
  • Emscripten (optional, for WebAssembly builds)

🛠 Build Instructions

Clone the Repository

git clone https://github.com/rolandbrake/piscript.git
cd piscript

Build Targets

make release       # Optimized build
make debug         # Debug build
make emscripten    # WebAssembly build
make run           # Run release build
make clean         # Clean build artifacts

Run the Interpreter

 run test.pi

🧪 Example

// Pi-Script example
clear(12)

for y in 0..127
    for x in 0..127
        if ((x + y) % 10 == 0)
            pixel(x, y, 6)

draw()

Run this example:


About

Piscript is a lightweight scripting language inspired by Python, built in C for speed and simplicity. It features a built-in 128x128 pixel graphics display and supports functional programming, matrix math, and WebAssembly via Emscripten. Ideal for learning, experimentation, and building retro-style visual programs.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors