Re:The cost of forsaking C
by JoeAltmaier on Wednesday October 05, 2016 @09:05AM
(#12643435)
OR, it would look like "decorate a semantic tree until the declaration is complete. Now, what do we have? An array of pointers to int. Fine."
[ Parent
| on HN ]
Re:The cost of forsaking C
by microcolonel on Wednesday October 05, 2016 @04:09PM
(#12647345)
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.
You 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.
Re:The cost of forsaking C
by microcolonel on Friday October 07, 2016 @09:20AM
(#12660406)
Is 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.