Making a Compiler from scratch | Beginnings of AST GENERATION | 002
HTML-код
- Опубликовано: 21 окт 2024
- In this stream we fend off back-seat bikeshedders, as well as make some sizeable progress on the parser stage of our compiler. Exciting stuff, as we finally get past the basics that everybody knows how to do, and get into the weeds of making a compiler, AKA where it will actually differ from any other compiler. We had a lot of fun today and I would like to especially thank tinnaangel and MrMugame for bringing positive vibes to the stream, and being all around cool people. -- Watch live at / lens_r
Source code: github.com/Len...
Discord: / discord
Donate: www.paypal.com...
Still loving this and the way you present it
You are my god damn ideal. The very first things I want to do after I become a good programmer, you do it for fun! Love you bro! Why didn't I find you previously?!
'Member' functionality as you say, is possible in C:
pointer decay with function pointers in the struct...
```
typedef struct A {
char *title;
void (*print)(struct A*)
} A;
static void print_title(A *in) {
printf("%s", in->title);
}
A this_title = {.title="Say What?!", .print=print_title};
this_title.print(&this_title);
```
Not the prettiest, but damn useful me thinks.
Have a look at "21st Century C" by Ben Klemens, page 258