3 ms·
> I also am not aware of any that doesn’t. Can you give an example of CPython, or GCC/clang autocorrecting a parse error?
by Retr0id 5y ago
> I also am not aware of any that doesn’t.
Can you give an example of CPython, or GCC/clang autocorrecting a parse error?
- borodi 5y agoThey do auto correction while parsing. If you have a C code and forget a semicolon or something else. It will try to guess a way to fix it in order to parse the rest of the program, in order to give you other possible errors it found. There even is the -Wfatal-errors flag to disable this functionality.
- chrisseaton 5y agoHave you ever seen GCC or Clang give more than one error message for a program? They're able to provide more than one error message because they correct the first error, and then continue parsing.
- vincent-manis 5y agoFor some value of “correct”. Actually, it's often more like skipping a few tokens until some kind of synchronization point (e.g., a semicolon) is reached. It's good manners for a compiler that does this to refuse to produce a binary.
- zauguin 5y agoAs a clang++ demonstration see https://godbolt.org/z/bTMT6qd4f https://godbolt.org/z/bTMT6qd4f. The failing `static_assert` uses the variable `i` which comes from the line missing a semicolon. It only reaches this assert because the compiler internally fixed the first error.