What is the main purpose of a compiler's syntax analysis phase?
A
Manage memory allocation
B
Check code structure against language grammar rules
C
Execute the program
D
Store data
Correct Answer: Option B — Check code structure against language grammar rules
Explanation:
Syntax analysis, also called parsing, checks whether the source code's structure conforms to the grammatical rules of the programming language before further processing.