Follow

Yesterday I did lot of yak-shaving on my C compiler project.

Mostly implementing a generic tree structure for the AST.
Obviously, I need some way to represent the AST before I can actually parse stuff into it.

Turns out a tree where nodes have N children, but 1 parent is not a thing in standard libraries. It took a while to write it, but wasn't hard.

@s this feels like something every C programmer ends up writing themselves and I hated bixeshedding my implementation 😅

@s If you were writing your C compiler in a LISP variant, n-ary trees would not be a problem, since that's what S-expressions are 😎

Sign in to participate in the conversation
Mastodon

social.samathy.space is one server in the network