SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
neither logical nor grammatical error
|
|
logical errors only
|
|
grammatical errors only
|
|
both grammatical and logical errors
|
Detailed explanation-1: -Explanation: Compiler can only check syntax errors.
Detailed explanation-2: -The primary function of a compiler is to translate the source code into an executable program. Grammatical Errors:-A compiler can detect grammatical errors in the source code. Grammatical errors are syntax errors that violate the rules of the programming language.
Detailed explanation-3: -Explanation: The compiler is only capable of detecting whether the code is written according to the syntax of the programming language. Therefore, it can only diagnose grammatical errors only. It will not throw an error in case of a logical error.
Detailed explanation-4: -Runtime errors: dynamic semantic errors, and logical errors, that cannot be detected by the compiler (debugging).