3 ms·
Yes. May need to back track due to context sensitivity. A quote from the source comments: Some C++ constructs require arbitrary look ahead to disambiguate.
by waynecochran 8y ago
Yes. May need to back track due to context sensitivity. A quote from the source comments:
Some C++ constructs require arbitrary look ahead to disambiguate.
For example, it is impossible, in the general case, to tell whether
a statement is an expression or declaration without scanning the
entire statement.
I am sure there must be some devilish source code examples that require an exponential search for the correct parse. Also, has anyone constructed a modern C++ parser in bison which can backtrack?
- lallysingh 8y agoGcc 3.3 and before had one, but they decided to write one by hand going forward. I don't think it's reasonable to do so without keeping context.