buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.22k stars 34 forks source link

`cdef` #167

Open giann opened 1 year ago

giann commented 1 year ago
cdef("/path/to/foreign", `
    typedef struct Person
    {
        unsigned int age,
        const char *title name,

        fn hello(self: Person) void;
    };

    void hello(*Person self);

    unsigned int mul(unsigned int a, unsigned int b);
`);

cdef("/path/to/foreign", "foreign.h")

| No different from an buzz object instanciation in syntax
Person person = Person{
    age = 12,
    name = "Joe",
};

person.hello();

print("{person}"); | -> struct Person: 0xef231b

mul(123, 243);

Try to get an AST using arocc.