3 ms·
Yeah, I don't know what these fools are complaining about. You put up a struct, parse the whole statement into it. Doesn't seem so tough to me.
by microcolonel 10y ago
Yeah, I don't know what these fools are complaining about. You put up a struct, parse the whole statement into it. Doesn't seem so tough to me.
- rayiner 10y agoYou can't put up a struct because the structure of a C type is arbitrarily complex. E.g. Multiple levels of pointers. So you have to maintain a type as some sort of tree, and then as you're parsing it you have to fill in the right parts of the tree. Not rocket science, obviously, but the original statement was that C types were designed to be easy to parse, which clearly isn't true. If the types were prefix or postfix, it'd be trivial to build the trees in a recursive descent parser.
- microcolonel 10y agoIs it arbitrarily complex? Maybe nested array types, but every other type can be expressed with an indirection count, and a leaf type. That said, if it can't go in a struct, it can easily go in a linked list with the same information for each level of indirection.
- kevinnk 10y agoWhat about function types? That alone gets you to "tree" complexity.