Site icon i2tutorials

Compiler Design-Syntax Error Handling

Syntax Error Handling

 

Syntax Error

Syntax or Syntactic errors are the errors that arise during syntax analysis. These errors can be the incorrect usage of semicolons, extra braces, or missing braces.

 

In C or Java, syntactic errors could be a case statement without enclosing the switch.

 

Syntactic Error Detection

We can detect syntax error through the use of precise parsing methods. The parsing methods, such as LL and LR can detect the errors immediately after their occurrence. They possess viable prefix property according to which an error is triggered whenever a prefix of the input string is not considered as a string. Alternatively, an error is triggered upon encountering the sequence of tokens from the lexical analysis that cannot be parsed any more according to the language grammar. 

 

However, the error handler has to achieve following goals during parsing.

 

 

Reference Link

Syntax Error Handling

Exit mobile version