Skip to content

Commit f5baa71

Browse files
committed
feat: Add async/await support with new IR generation and updated documentation.
1 parent 001a74c commit f5baa71

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,28 @@ use local_helper;
251251

252252
func main() {
253253
let result = std.math.sqrt(16);
254+
254255
print("Square root of 16: " + to_string(result));
255256
}
256257
```
257258

259+
### Async/Await
260+
261+
ProXPL supports native asynchronous programming:
262+
263+
```javascript
264+
async func fetchUser(id) {
265+
// Simulate non-blocking operation
266+
return {"id": id, "name": "User" + to_string(id)};
267+
}
268+
269+
async func main() {
270+
print("Fetching user...");
271+
let user = await fetchUser(42);
272+
print("Got user: " + user["name"]);
273+
}
274+
```
275+
258276
### Standard Library Examples
259277

260278
```javascript

src/compiler/ir_gen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "../../include/ir.h"
88
#include "../../include/ast.h"
9+
#include "../../include/object.h"
910
#include <stdlib.h>
1011
#include <string.h>
1112
#include <stdio.h>

src/compiler/parser/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Forward declarations of parsing functions
1717
static Stmt *declaration(Parser *p);
1818
static Stmt *statement(Parser *p);
19-
static Stmt *funcDecl(Parser *p, const char *kind);
19+
static Stmt *funcDecl(Parser *p, const char *kind, bool isAsync);
2020
static Stmt *classDecl(Parser *p);
2121
static Stmt *varDecl(Parser *p);
2222
static Stmt *useDecl(Parser *p);

0 commit comments

Comments
 (0)