Skip to content

authorss81/Ipp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

217 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 · Lambda Functions · Bytecode VM · Async/Await · 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.5.30 includes Emergency Bug Fixes: For-in loop, pi/e constants, let immutability, str method, static methods, continue in loops, and MultiVarDecl + Dict comprehension.


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.

Install via PyPI

pip install ipp-lang
ipp repl
ipp run hello.ipp

VSCode Extension

Note: VSCode extension marketplace publish coming soon. Currently available for local installation.

Ipp includes a VSCode extension in vscode-extension/:

cd vscode-extension
npm install
npm run compile
code .

Features:

  • Syntax highlighting
  • 15 code snippets (func, class, for, while, if, match, try, etc.)
  • Task runner for ipp run and ipp check
  • LSP support: go-to-definition, completion, hover, rename

Commands:

  • ipp lsp — Start LSP server
  • F5 — Run current file

REPL Features

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

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

  Ipp  v1.5.4.5
  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

Async/Await (4)

async_run, create_task, is_coroutine, sleep

Additional Builtins (31)

seed, normal, now, delta, format_duration, from_hex, to_hex, blend, hsl, ease_in, ease_out, bounce, spring, read_lines, words, truncate, pad_left, pad_right, reverse, binary_search, group_by, zip_with, find_all, sub, escape, glob, pathfind, neighbors, flood_fill, assert_eq, inspect


Async/Await + Coroutines

Ipp supports async/await with a built-in event loop:

async func fetch_data(url) {
    print("Fetching:", url)
    sleep(0.1)
    return "data from " + url
}

var coro = fetch_data("https://example.com")
var result = async_run(coro)
print(result)  # data from https://example.com

Multiple Workers

async func worker(name, delay) {
    print(name, "started")
    sleep(delay)
    print(name, "finished")
    return name + " done"
}

var r1 = async_run(worker("Worker1", 0.01))
var r2 = async_run(worker("Worker2", 0.02))

Built-in Async Functions

Function Description
async_run(coro) Run a coroutine and wait for result
create_task(coro) Create and run a coroutine task
is_coroutine(obj) Check if object is a coroutine
sleep(seconds) Sleep for given seconds (awaitable)

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 (ERRORS.md)
v1.4.2 Tutorial Documentation + Getting Started Guide (TUTORIAL.md)
v1.4.3 PyPI Publishing + pip install ipp-lang
v1.5.0 Async/Await + Coroutines + Event Loop + 31 New Builtins
v1.5.1 VSCode Extension + LSP (snippets, task runner, hover, completion)
v1.5.2 WASM Backend Infrastructure + Web Playground
v1.5.3 2D Canvas API (Tkinter) + WebGL Bindings
v1.5.4.3 Easy Enhancements (.html, .hist, better errors)
v1.5.4.4 Medium Features (.bg, .jobs, .plot, .async)
v1.5.4.5 Advanced Features (.serve, .compare, REPL server)
v1.5.4.6 Expert Features (Plugins, ML autocomplete)
v1.5.5 3D Math (vec4, mat4, quat) + Scene Graph (Scene, Node, Camera, Mesh, Light)
v1.5.6 3D Primitives (mesh_cube, mesh_sphere, mesh_plane)
v1.5.7 3D Visualization (wireframe, point cloud rendering via canvas)
v1.5.8 Performance & Profiling (memory_info, benchmark, gc_stats) + Full OpenGL
v1.5.9 Error Handling & Debugging (get_stack_trace, error_info, breakpoints)
v1.5.10 Standard Library (math_degrees, math_gcd, fs_exists, date_timestamp)
v1.5.11 Module System (module_cache_info, import_module, list_exports)
v1.5.12 Documentation & Testing (doc, apidoc, test_report, benchmark_full)
v1.5.13 Final Polish (cleanup_check, perf_tips, health_check, version_info)
v1.5.14 Critical Bug Fixes (append, pop, insert, remove, clear + VM global_env fix)
v1.5.15 Syntax Additions (Lambda with func keyword, Match expression, Enum, else in match)
v1.5.16 VM/Performance (for-loop in VM works, .cache command, wasm_run function)
v1.5.17 Missing Features (HTML templates, f-strings, decorator @, event_loop, future, Unicode fix)
v1.5.18 PyPI Release Polish (workflow fix, documentation update)
v1.5.19 Polish (OpenGL shaders, async completion)
v1.5.20 Polish (OpenGL restored, data structures verified)
v1.5.21 Emergency Fixes (for-in loop in VM)
v1.5.22 Emergency Fixes (pi, e constants)
v1.5.23 Emergency Fixes (let immutability)
v1.5.24 Emergency Fixes (str method)
v1.5.25 Emergency Fixes (static methods)
v1.5.26 Emergency Fixes (continue in while/for loops + VM perf)
v1.5.27 Emergency Fixes (continue in for-in loops)
v1.5.28 Emergency Fixes (MultiVarDecl in VM)
v1.5.29 Fixes (list comprehension in interpreter)
v1.5.30 Emergency Fixes (dict comprehension)
v1.5.31 Fixes (global cache hash collision)
v1.5.31 Emergency Fixes (global cache hash collision)
v1.5.32 Emergency Fixes (SET_INDEX stack fix)
v1.5.33 Syntax (do-while) + Interpreter bug fix
v1.5.34 Exception (multiple catch blocks)
v1.5.35 Syntax (variadic parameters)
v1.5.36 Syntax (f-strings)
v1.5.37 Fix (VM import system)
v1.5.38 Fix (spread operator)
v1.6.0 Feature (operator overloading)
v1.6.1 Feature (exception type hierarchy)
v1.6.2 Feature (decorator execution)
v1.6.3 Feature (multiple return values)
v1.6.4 Feature (named function arguments)
v1.6.5 Feature (property accessors)
v1.6.6 Feature (signal/event system)
v1.6.7 Feature (list slicing)
v1.6.8 Feature (Matrix4x4 + Quaternion)
v1.6.9 Feature (async/await in VM)
v1.6.10 Fix (IppSet attribute)
v1.6.11 Fix (TAIL_CALL crash)
v1.6.12 Feature (fluent list methods)
v1.6.13 Feature (string format)
v1.6.14 Feature (bytecode caching)
v1.6.15 Feature (static linter)
v1.7.0 Interpreter (archive)
v1.7.1 Testing (opcode unit tests)
v1.7.2 Error Quality (line numbers + call stacks)
v1.7.3 Package Manager (ippkg)
v1.7.4 LSP (completion + diagnostics)
v1.7.5 WASM Backend (real implementation)
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 37 test suites pass with zero failures.


Contributing

See CONTRIBUTING.md for guidelines.

Fork → Branch → Fix → Pull Request


License

MIT License — see LICENSE for details.

About

a new programming language.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors