Lecture No. 10
Dated: 17-03-2025
Syntactic Analysis
The parser
1 ensures that sentences of a programming language that make up a program abide by the syntax of the language. If there are errors, the parser will detect them and reports them accordingly. Consider the following code segment that contains a number of syntax errors:
int* foo(int i, int j)) {
for ( k = 0; i j; )
fi( i > j )
return j;
}
It is clear that a scanner based upon regular expressions
2 will not be able to detect syntax error.
References
-
Read more about regular expressions. ↩