On Tue Oct 31 23:40:13 2023 +0000, Jacek Caban wrote:
[Expressions](https://en.wikipedia.org/wiki/Expression_(computer_science)) have their meaning and are a different things than types, it's more generic distinction than just a specific gramma rule. Sure, it's possible to pretend that types are expressions in data structures, but I think it adds more confusion and complexity. I don't see how accessing the type by something like `expr->u.args[0]->u.type` is cleaner than `expr->u.type`. You assume that `args[0]` is an expression carrying a type anyway, and take an extra step to construct an extra expr_t. Isn't it better to adjust `expr_t` to be explicit about that? And I'm not sure what you mean by type arguments being stored separately. Is it about the fact that it's not part of the union? That's only because you change it in an earlier patch in this series.
Expressions are just a sequence of tokens that can be evaluated to compute a resulting value. The result type may be a basic langage type, or it can be a type itself, in which case it's often called a "type expression". You can very well see declspecs as type expressions, with operators modifying the type values.
Anyway, I will make each expression kind its own struct, so that would solve the question.