The PonieScript programming language.
  • Rust 74.9%
  • PonieScript 17.4%
  • C 7.1%
  • Shell 0.2%
  • CSS 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
HoneyPony cf9beb7247
Some checks failed
Rust / build (push) Has been cancelled
Merge branch 'misc'
2025-12-30 19:54:17 -05:00
.github/workflows [Untested] Create rust.yml Github Action 2025-06-09 14:45:03 -04:00
compiler-tests ABI: Another test case in context-abi-comparison 2025-12-20 12:57:04 -05:00
evolution Get return types almost working 2024-06-27 16:49:36 -04:00
misc Lerp study 2025-11-30 13:06:33 -05:00
poni-arena Split Arena API into its own crate 2025-12-30 19:54:02 -05:00
poni-build chore: Clean up some warnings 2025-12-11 22:27:48 -05:00
poni-build-cli poni-build: Set CLICOLOR_FORCE so that colors show up 2025-12-11 22:30:43 -05:00
poni-doc docs: Nicer nav bar styles 2025-12-19 02:24:35 -05:00
poni-doc-cli docs: Basic implementation of heading collector 2025-12-19 01:31:22 -05:00
poniescript New binder::sneaky test 2025-12-20 16:33:45 -05:00
poniescript-core Split Arena API into its own crate 2025-12-30 19:54:02 -05:00
poniescript-gc Partial backtrace for panics 2025-12-06 16:37:51 -05:00
poniescript-lsp chore: Clean up some warnings 2025-12-11 22:27:48 -05:00
ponygame-mini Add UnboundCStructPtr 2025-08-12 11:54:01 -04:00
sketches More ranges sketch 2025-11-25 17:12:56 -05:00
.gitignore Barebones prototype for documentation generator 2025-12-16 12:28:08 -05:00
big1.sh Implement a speed test 2024-06-26 09:21:10 -04:00
big2.c Add another 'big' test 2024-06-26 17:49:42 -04:00
big3.c Add another 'big' test 2024-06-29 00:05:40 -04:00
big4.c Add big4.poni test/benchmark 2025-08-23 14:19:23 -04:00
big5.c New big5.poni test 2025-11-25 19:32:03 -05:00
big5_80000.c New big5_80000 test case 2025-12-01 11:25:43 -05:00
Cargo.lock Split Arena API into its own crate 2025-12-30 19:54:02 -05:00
Cargo.toml Split Arena API into its own crate 2025-12-30 19:54:02 -05:00
hot.mk Cleanup a bit 2025-07-25 21:41:31 -04:00
LICENSE Create LICENSE 2025-10-17 13:01:51 -04:00
README.md Update README.md for public repo 2025-08-23 18:57:36 -04:00
test-core.sh Fixes to location information 2025-08-25 23:19:02 -04:00
test-multicc-mold-prelude.sh New '--prelude-h' option for trying to speed up codegen 2025-12-01 12:27:11 -05:00
test-multicc-mold-prelude8.sh One more benchmarker .sh 2025-12-01 12:30:27 -05:00
test-multicc-mold.sh More performance testing stuff 2025-11-29 22:41:07 -05:00
test-multicc.sh More performance testing stuff 2025-11-29 22:41:07 -05:00
test-perf-mold.sh More performance testing stuff 2025-11-29 22:41:07 -05:00
test-singlecc-mold.sh More performance testing stuff 2025-11-29 22:41:07 -05:00
test.poni Initial binary expression implementation 2024-06-26 00:41:20 -04:00

PonieScript

PonieScript is the scripting language for PonyGame. It is statically typed, AOT compiled (to C), and designed to be usable for game scripting.

The original philosophy of PonieScript is that C itself--with some well tuned macros and APIs--is "almost good enough" for game scripting, but not quite. PonieScript is therefore intended to be semantically dependent on C, at least for the foreseeable future--that is, it is philosophically a C preprocessor that is just "a little complicated." PonieScript has diverged a bit from this philosophy by now but it is still somewhat relevant.

Although PonieScript is semantically dependent on C, a core goal is to make the semantics of PonieScript quite precise. That is, correctness (of the compiler implementation) is more important than speed (of the compiled code).

WORK IN PROGRESS

PonieScript is currently a heavy work in progress. There are many compiler bugs and limitations at this time. It is slowly converging on a working product.

Build process

Right now, PonieScript cannot actually be used with PonyGame. It is currently heavily in development. It can still be used standalone, although not very usefully at the moment. The PonieScript compiler is written in Rust so compiling should be as simple as:

cargo build

To use PonieScript requires a C compiler. It currently expects to be run in the working directory of this git repo -- that is, it generates C files that #include "poni/poni.h", where the 'poni' directory is the very same one in this repo.

Examples

Instead of the traditional main, PonieScript allows for an (optional) entry point of init -- which corresponds to the initialization code for a PonyGame game. For standalone apps, you can use init as the entry point of the entire program.

Hello world is straightforward:

fun init() {
    print("Hello, world!");
}

Here is an example showing some function syntax:

fun fib(n: int) -> int {
    if n < 2 { return n; }

    // Implicit return at end of blocks.
    // (Either with or without semicolon).
    fib(n - 1) + fib(n - 2);
}

fun helper(n: int) {
    print("fib(", n, ") = ", fib(n));
}

fun init() {
    helper(5);
    helper(10);
    helper(15);
}

Here is an example showing a little bit about classes:

class Pony {
    var greeting = "neigh";

    fun greet() {
        print(greeting);
    }
}

fun init() {
    var pony0 = new Pony{};
    var pony1 = new Pony { greeting: "good afternoon" };

    pony0.greet();
    pony1.greet();
}