COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The compiler can detect what type of errors?
A
neither logical nor grammatical error
B
logical errors only
C
grammatical errors only
D
both grammatical and logical errors
Explanation: 

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).

There is 1 question to complete.