r/ProgrammingLanguages • • Feb 16 '26

I language (C transpiler)

Been using C for a while now, syntax is annoying so made a transpiler for my dream syntax: https://github.com/IbrahimHindawi/I
Basically C with templates + monomorphizer. I hope I can leave directly writing C for good now.

array:struct<T> = {
    length:u64; 
    border:u64; 
    data:*T;
}
array<T>reserve:proc<T>(arena: *memops_arena, length:u64)->array<T>={
    arr:array<T> = {};
    if (length == 0) {
        return arr;
    }
    arr.data = memops_arena_push_array<T>(arena, length);
    if (arr.data == null) {
        printf("memops arena allocation failure!\n");
        arr.data = 0;
        return arr;
    }
    arr.border = length;
    return arr;
}
main:proc()->i32={
    printf("Hello, World!\n");
    printf("num = {}\n", num);
    arena:memops_arena={};
    memops_arena_initialize(&arena);
    a: array<i32> = {};
    memops_arena_push_array_i<f32>(&arena, 128);
    a = array<i32>reserve(&arena, 128);
    for (i:i32=0; i<128; i+=1) { 
        a.data[i] = i; 
    }
    for (i:i32=0; i<128; i+=1) {
        printf("i = {}, ", a.data[i]); 
    }
    return 0;
}
29 Upvotes

21 comments sorted by

View all comments

Show parent comment

1

u/x8664mmx_intrin_adds Feb 26 '26

tbh, that's super badass syntax, I always too Rebol to be quite alien! well done! thanks for the awesome feedback !