4 ms·
For the context sensitive part, all you need is a symbol table to check which names are for types. I haven't actually done it but I don't think it is hard. The
by jstimpfle 3y ago
For the context sensitive part, all you need is a symbol table to check which names are for types. I haven't actually done it but I don't think it is hard.
The real problem is the preprocessor, it's very hard to implement, and implement in a standards-compliant way. (haven't finished one either, but everybody says so). And without preprocessor and proper include processing, you simply can't parse correctly because you lack the context of which types are defined (besides missing preprocessor symbols).
Another problem that comes with that is that you always have to parse everything from beginning to end -- including the include files, which can easily be 10s or 100s of thousands of lines of code. I haven't seen a real performant and always correct parser for C IDEs, not sure if one exists.