This is the project I need a tree data structure for. The parser would return a populated tree data structure instead of emitting SmileBASIC. The parser would pass this tree to the type checker and the type checker would type check everything recursively with a DFS algorithm if it encounters a type error it will alert the user and stop. If no errors are encountered the type checker will pass the type checked tree on to the code generator etc. etc.

Right. If you do get that malloc/tree implementation, it would be neat if you could publish it as a separate library so other people can find it easily, too.

Will do, I think I've got an idea on how things should work. Just need to get a working flow chart done on paper so I can visualize things.

You may be interested in the shunting yard algorithm (if you aren't using it already.)

Replying to:snail_You may be interested in the shunting yard algorithm (if you aren't using it already.)

But if you use the shunting yard algorithm BE SURE that you mark a way for the output to know where a parentheses end.
Otherwise you'll have a bug where a function's parameters fade into another function and it becomes a big mess trying to estimate how many arguments each function has
But yes, use the Shunting Yard Algorithm, as it is much higher performance compared to an abstract syntax tree.
ASTs should be used for Computer Algebra Systems only, cause they allow moving around operators and arguments to simplify
If you have any questions message me

Replying to:snail_You may be interested in the shunting yard algorithm (if you aren't using it already.)

I used shunting yard to do something similar in JS, but I added functions by just bodging together prefix operators. There really isn't much difference between sin x and sin(x) so it worked okay. The consequence is that they only took one variable.