0

If a compiler can detect errors, then why can't it remove them...?

If the compiler knows that, "Semicolon is missing at line number 69", then why it can't simply put ' ; ', instead of giving us error...☹️

12th Jun 2020, 8:57 AM
DEEPAK PATEL
DEEPAK PATEL - avatar
3 ответов
+ 5
IMO it would be way worse if it does that. If you want that functionality use an IDE. It is better than compilers editing your source code silently. Also some compilers for example Go's compiler will automatically add a semicolon for you. This however can cause unexpected results e.g for loop braces can't start in a new line.
12th Jun 2020, 9:07 AM
Ore
Ore - avatar
+ 2
That's what JavaScript does. However, most programming languages expect you to follow their rules, even if the compiler/interpreter "knows what you meant".
16th Jun 2020, 2:14 AM
SapphireBlue
SapphireBlue - avatar