4 ms·
Parsing it manually is actually the preferred choice for most compilers, both GCC and Clang do it manually, for example.
by fao_ 5y ago
Parsing it manually is actually the preferred choice for most compilers, both GCC and Clang do it manually, for example.
- SavantIdiot 5y agoReally? That's probably why I failed! Ironically (given my post) I've never looked at Clang's parser. I have looked at GCC's and, well, sheepishly: I don't get it, it is a beast of a project and I wasn't able to crack the architecture. I should try again tho.
- rot13xor 5y agoC is almost context-free with the exception of typedef. A custom parser helps with error diagnostics, e.g. missed semicolon or a "." swapped with "->". https://eli.thegreenplace.net/2007/11/24/the-context-sensitivity-of-cs-grammar https://eli.thegreenplace.net/2007/11/24/the-context-sensiti...