Types of Errors in compiler construction
Types of Errors in compiler construction There are two major errors that can occur in during compiler construction Syntactic Error Semantic Error Syntactic Error Syntax errors are errors in the program text; they may be either lexical or grammatical or an arithmetic expression with unbalanced parentheses, misplaced or mismatched parentheses. for example while ( { printf("hi); } In this while has missing ending parentheses while ( ) and in printf parentheses one double quotes is missing ( "hi " ) lexical error A lexical error is also types of the syntactic is a mistake in a lexeme, for examples, typing tehn instead of then, or missing off one of the quotes in a literal. for example typing int hero; we typed her = 5; Or Misspellings and identifier ,keyword or operator . Grammatical error A grammatical error is a one that violates the (grammatical) rules of the language, for example if x = 7 y :=