Skip to main content

A beginner-friendly scripting language for game development

Project description

Ipp Language

Version Python License Builtins Tests Status

A beginner-friendly scripting language for game development.
Python-like syntax · Closures · Classes with Inheritance · Pattern Matching · Bytecode VM · World-Class REPL


What is Ipp?

Ipp is a dynamically-typed, interpreted scripting language designed to feel like Python and Lua combined, built specifically for game development scripting. It compiles to a custom bytecode VM and also runs on a tree-walking interpreter for rapid development.

v1.4.0 includes 132+ built-in functions, 46 passing regression tests, generator functions (yield), a world-class REPL with tab completion, debugging, session management, and comprehensive standard library coverage including HTTP/FTP/SMTP networking, data formats, math, collections, and game primitives.


Quick Start

# Clone the repo
git clone https://github.com/authorss81/Ipp
cd Ipp

# Run a script
python main.py examples/hello_world.ipp

# Start the REPL
python main.py

No dependencies required. Python 3.8+ only.


REPL Features

Ipp has a world-class REPL with 30+ built-in commands:

  ██╗██████╗ ██████╗
  ██║██╔══██╗██╔══██╗
  ██║██████╔╝██████╔╝
  ██║██╔═══╝ ██╔═══╝
  ██║██║     ██║
  ╚═╝╚═╝     ╚═╝

  Ipp  v1.3.10
  A scripting language for game development
──────────────────────────────────────────
  ❯ var x = 2 ** 10
  → 1024  0.1ms

  ❯ var name = "World"
  ❯ print("Hello, " + name + "!")
  Hello, World!

Tab Completion

  • Builtins: Type ht + Tab → http_get, http_post, http_put, etc.
  • Variables: Type my + Tab → my_variable, etc.
  • Dict keys: Type person[" + Tab → name, age, city
  • Fuzzy matching: htgthttp_get, http_put
  • REPL commands: .h + Tab → .help, .history

REPL Commands

Category Commands
Core .help, .vars, .fns, .builtins, .modules, .types, .version, .clear
Session .load, .save, .export, .session save/load/clear/export, .sessions
History .history, .last, $_, .history $_
Undo/Redo .undo, .redo
Debugging .debug start/stop, .break <line>, .watch <expr>, .locals, .stack
Inspection .which <name>, .doc <fn>, .pretty <expr>, .json <expr>, .table <var>
Performance .time <expr>, .profile
Shell ! <cmd>, .pipe <cmd>, .cd <dir>, .ls [dir], .pwd
Customization .theme dark/light/solarized, .prompt dir/time/full, .alias, .bind
Code .edit, .format <expr>, .search <kw>, .examples, .tutorial, .plugin load

Prompt Customization

  • .prompt ipp — Default prompt ()
  • .prompt dir — Show current directory ((Ipp) ❯)
  • .prompt time — Show current time ([14:30:00] ❯)
  • .prompt full — Show time + directory ([14:30:00] C:\Ipp ❯)

Color Themes

  • .theme dark — Dark theme (default)
  • .theme light — Light theme
  • .theme solarized — Solarized theme

Language Tour

Variables

var x = 10          # mutable
let y = 20          # immutable binding
var name: string = "Ipp"   # optional type annotation

Compound Assignment

var score = 0
score += 10
score *= 2
score -= 5

Functions & Closures

func greet(name) {
    return "Hello, " + name
}

# Named arguments
greet(name="Alice", greeting="Hi")

# Closures
func make_counter() {
    var count = 0
    return func() {
        count = count + 1
        return count
    }
}
var counter = make_counter()
print(counter())  # 1
print(counter())  # 2

Lambda Expressions

var double = func(x) => x * 2
print(double(5))  # 10

Classes & Inheritance

class Animal {
    func init(name) {
        this.name = name
    }
    func speak() {
        print(this.name + " makes a sound")
    }
}

class Dog : Animal {
    func speak() {
        print(this.name + " says woof!")
    }
}

var dog = Dog("Rex")
dog.speak()  # Rex says woof!

Pattern Matching

var x = 2
match x {
    case 1 => print("one")
    case 2 => print("two")
    case 3 => print("three")
    default => print("other")
}

Error Handling

try {
    var result = risky_operation()
} catch e {
    print("Error: " + e)
} finally {
    print("Cleanup")
}

List Comprehensions

var squares = [x*x for x in 1..10]
var evens = [x for x in 1..20 if x % 2 == 0]

Nullish Coalescing

var name = user_name ?? "Anonymous"

Ternary Operator

var status = age >= 18 ? "adult" : "minor"

Tuple Unpacking

var a, b = [1, 2]
print(a)  # 1
print(b)  # 2

Operator Overloading

class Vector {
    func init(x, y) {
        this.x = x
        this.y = y
    }
    func __add__(other) {
        return Vector(this.x + other.x, this.y + other.y)
    }
}

Custom __str__ Method

class Point {
    func init(x, y) {
        this.x = x
        this.y = y
    }
    func __str__() {
        return "(" + this.x + ", " + this.y + ")"
    }
}
var p = Point(3, 4)
print(p)  # (3, 4)

Built-in Functions (130+)

Core (20)

print, len, type, input, exit, assert, str, int, float, bool, to_number, to_int, to_float, to_bool, to_string, abs, min, max, sum, range

Math & Trigonometry (22)

sin, cos, tan, asin, acos, atan, atan2, log, log10, degrees, radians, pi, e, sqrt, pow, round, floor, ceil, lerp, clamp, distance, normalize, dot, cross, sign, smoothstep, move_towards, angle, factorial, gcd, lcm, hypot, floor_div

Random (5)

random, randint, randfloat, choice, shuffle

String (18)

upper, lower, strip, split, join, replace, replace_all, starts_with, ends_with, find, index_of, char_at, substring, count, contains, split_lines, ascii, from_ascii

File I/O (7)

read_file, write_file, append_file, file_exists, delete_file, list_dir, mkdir

Data Formats (15)

json_parse, json_stringify, xml_parse, xml_to_string, yaml_parse, yaml_to_string, toml_parse, toml_to_string, csv_parse, csv_parse_dict, csv_to_string, regex_match, regex_search, regex_replace, hash

Hashing & Encoding (8)

md5, sha256, sha1, sha512, base64_encode, base64_decode, gzip_compress, gzip_decompress

Collections (12)

keys, values, items, has_key, set, deque, ordict, PriorityQueue, Tree, Graph, uuid4, uuid1

Networking (12)

http_get, http_post, http_put, http_delete, http_request, http_serve, ftp_connect, ftp_disconnect, ftp_list, ftp_get, ftp_put, smtp_connect, smtp_disconnect, smtp_send

WebSocket (4)

websocket_connect, websocket_send, websocket_receive, websocket_close

URL Utilities (6)

url_parse, url_build, url_encode, url_decode, url_query_parse, url_query_build

Time & OS (10)

time, sleep, clock, datetime, os_platform, os_cwd, env_get, env_set, path_dirname, path_basename

Advanced (8)

printf, sprintf, scanf, logger, thread, thread_sleep, thread_current, argparse

Game Types (4)

vec2, vec3, color, rect, complex

Generators (2)

next, is_generator


Generators

Ipp supports generator functions using the yield keyword:

func count_up() {
    var i = 0
    while i < 5 {
        yield i
        i = i + 1
    }
}

var gen = count_up()
print(next(gen))  # 0
print(next(gen))  # 1
print(next(gen))  # 2

For-in with Generators

func fibonacci(n) {
    var a = 0
    var b = 1
    var count = 0
    while count < n {
        yield a
        var temp = a
        a = b
        b = temp + b
        count = count + 1
    }
}

for n in fibonacci(10) {
    print(n)  # 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
}

Generator Utilities

var gen = count_up()
print(is_generator(gen))  # true
print(is_generator(42))   # false

Standard Library

HTTP Client

var res = http_get("https://httpbin.org/get")
print(res["status"])
print(res["body"])

var post_res = http_post("https://httpbin.org/post", "data=value")

HTTP Server

func handler(method, path, headers, body) {
    return (200, {"Content-Type": "text/plain"}, "Hello from Ipp!")
}
http_serve(handler, "localhost", 8080)

FTP Client

var ftp = ftp_connect("ftp.example.com", "user", "pass")
var files = ftp_list(ftp)
ftp_get(ftp, "remote.txt", "local.txt")
ftp_disconnect(ftp)

SMTP Email

var smtp = smtp_connect("smtp.gmail.com", 587, true, "user@gmail.com", "password")
smtp_send(smtp, "user@gmail.com", "recipient@example.com", "Subject", "Body")
smtp_disconnect(smtp)

PriorityQueue

var pq = PriorityQueue()
pq.push("low", 3)
pq.push("high", 1)
pq.push("medium", 2)
print(pq.pop())  # high
print(pq.pop())  # medium

Tree

var root = Tree("root")
root.add_child(Tree("child1"))
root.add_child(Tree("child2"))
print(root.traverse_preorder())
print(root.traverse_bfs())

Graph

var g = Graph()
g.add_edge("A", "B", 1)
g.add_edge("B", "C", 2)
g.add_edge("A", "C", 4)
print(g.shortest_path("A", "C"))  # [A, B, C]

Version History

Version Focus
v1.3.0 String interpolation, REPL redesign
v1.3.1 Performance optimization
v1.3.2 VM upvalues, Set type, bug fixes
v1.3.3 Bug fixes + Standard Library + Networking (HTTP/FTP/SMTP)
v1.3.4 Comprehensive stdlib testing (130+ builtins)
v1.3.5 Regex fix + REPL color fix
v1.3.6 VM compatibility tests + REPL warning
v1.3.7 REPL enhancements (.load, .save, .doc, .time, .which, .undo, .profile, .alias, .edit, .last)
v1.3.8 HTTP Server, WebSocket, PriorityQueue, Tree, Graph
v1.3.9 REPL error handling (smart suggestions, highlight fix, .colors fix)
v1.3.10 REPL Intelligence (tab completion, debugger, pretty printing, shell integration, themes)
v1.4.0 Generator functions (yield) + VM Bug Fixes (all 7 VM bugs fixed)
v1.4.1 Error Documentation + Error Reference Guide
v1.4.2 Tutorial Documentation + Getting Started Guide
v1.4.3 PyPI Publishing + pip install ipp-lang
v1.5.0 Async/Await + Coroutines + Event Loop
v1.5.1 WASM Compilation + Web Playground
v1.5.2 WebGL Integration + 2D Canvas Rendering
v1.5.3 3D Rendering + Scene Graph
v1.6.0 C++ Integration + Native Extensions
v1.6.1 Cross-Platform (iOS, macOS, Linux, Windows Installer)
v1.6.2 Language Server Protocol (LSP)
v1.6.3 VSCode Extension + IDE Integration
v2.0.0 Package Manager + Full Ecosystem + Game Engine

Testing

# Run all regression tests
python tests/regression.py

# Run a single test
python main.py run tests/v1_3_10/test_repl_intelligence.ipp

All 29 test suites pass with zero failures.


Contributing

See CONTRIBUTING.md for guidelines.

Fork → Branch → Fix → Pull Request


License

MIT License — see LICENSE for details.

Project details


Release history Release notifications | RSS feed

This version

1.4.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipp_lang-1.4.2.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipp_lang-1.4.2-py3-none-any.whl (73.0 kB view details)

Uploaded Python 3

File details

Details for the file ipp_lang-1.4.2.tar.gz.

File metadata

  • Download URL: ipp_lang-1.4.2.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ipp_lang-1.4.2.tar.gz
Algorithm Hash digest
SHA256 dde50e326ee68ed82cfc4cb1546c692af255509750777047ef06c2ff81d3dc6d
MD5 a45b6f9778ed101d6a95b1332130c28d
BLAKE2b-256 d8134a5086a533641c3ddd86e94133429e9e2ea39feae200bd8b58aaa61f9435

See more details on using hashes here.

File details

Details for the file ipp_lang-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: ipp_lang-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 73.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ipp_lang-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d6c1b796702173ee5e405fbbf4dded28c00cecfcfc3414fdb9cddc0f7846063
MD5 90d7ffcdaabf2065ece1f312cd456b8b
BLAKE2b-256 a819f23df5fc3b67de09fa5d53f8239c02e8f61fa93b250063375e565d83e1a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page