|
1 | 1 | # PonieScript |
2 | 2 | PonieScript is the scripting language for [PonyGame](https://github.com/HoneyPony/ponygame). It is statically typed, AOT compiled (to C), and designed to be usable for game scripting. |
3 | 3 |
|
4 | | -The fundamental 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, |
5 | | -at least for the foreseeable future -- that is, it is philosophically a C preprocessor that is just "a little complicated." |
| 4 | +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, |
| 5 | +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. |
6 | 6 |
|
7 | | -That said, although it is semantically dependent on C, a core goal is to make the semantics of PonieScript quite precise. That is, |
| 7 | +Although PonieScript is semantically dependent on C, a core goal is to make the semantics of PonieScript quite precise. That is, |
8 | 8 | correctness (of the compiler implementation) is more important than speed (of the compiled code). |
9 | 9 |
|
| 10 | +## WORK IN PROGRESS |
| 11 | + |
| 12 | +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. |
| 13 | + |
10 | 14 | ## Build process |
11 | 15 |
|
12 | 16 | 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 |
@@ -49,19 +53,21 @@ fun init() { |
49 | 53 | } |
50 | 54 | ``` |
51 | 55 |
|
52 | | -And a closure example: |
| 56 | +Here is an example showing a little bit about classes: |
53 | 57 | ```c |
54 | | -fun make_printer(message: StrConst) -> fun() { |
55 | | - return fun() { |
56 | | - print(message); |
| 58 | +class Pony { |
| 59 | + var greeting = "neigh"; |
| 60 | +
|
| 61 | + fun greet() { |
| 62 | + print(greeting); |
57 | 63 | } |
58 | 64 | } |
59 | 65 |
|
60 | 66 | fun init() { |
61 | | - var hello = make_printer("hello"); |
62 | | - var world = make_printer("world"); |
| 67 | + var pony0 = new Pony{}; |
| 68 | + var pony1 = new Pony { greeting: "good afternoon" }; |
63 | 69 |
|
64 | | - hello(); |
65 | | - world(); |
| 70 | + pony0.greet(); |
| 71 | + pony1.greet(); |
66 | 72 | } |
67 | 73 | ``` |
0 commit comments