This commit is contained in:
luboslenco
2024-12-29 12:20:11 +01:00
parent 61b7f32e54
commit 90f07a5601
3 changed files with 0 additions and 48 deletions
-43
View File
@@ -1,43 +0,0 @@
# alang
alang is a TypeScript to C transpiler. A small subset of TypeScript is supported which maps well with C in order to achieve the best performance.
```ts
// TS
type point_t = {
x: f32;
y: f32;
};
function add(a: point_t, b: point_t) {
a.x += b.x;
a.y += b.y;
}
function main() {
let a: point_t = { x: 1.0, y: 2.0 };
let b: point_t = { x: 3.0, y: 4.0 };
add(a, b);
}
```
```c
// C
#include <iron.h>
typedef struct point {
f32 x;
f32 y;
} point_t;
void add(point_t *a, point_t *b) {
a->x += b->x;
a->y += b->y;
}
void main() {
point_t *a = GC_ALLOC_INIT(point_t, { x: 1.0, y: 2.0 });
point_t *b = GC_ALLOC_INIT(point_t, { x: 3.0, y: 4.0 });
add(a, b);
}
```
-2
View File
@@ -1,6 +1,4 @@
// ../../make --graphics opengl --compile --alangjs
///include <stdio.h>
let alang_output: string = null;
-3
View File
@@ -1,7 +1,4 @@
// ../../make --compile --alangjs --ccompiler gcc --cppcompiler g++
// (gcc has lto enabled)
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>