|How to improve the error handling of my scanner? firstname.lastname@example.org (John Williams) (2009-01-10)|
|Re: How to improve the error handling of my scanner? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-01-13)|
|From:||John Williams <email@example.com>|
|Date:||Sat, 10 Jan 2009 19:27:31 +0100|
|Keywords:||parse, errors, question|
|Posted-Date:||12 Jan 2009 15:26:06 EST|
I finally built my scanner and parser using Coco/R, but I need some help to
improve error handling.
For example, I tried to parse the following program:
VAR 4fgnn : INTEGER;
There's obviously an error with "4fgnn", it is a bad identifier because it
starts by a number. This is the compiler output:
line 2 col 12: "END" expected
Of course it detects the error, but it is kind of vague.
I thought of adding a PRAGMA section to my ATG Grammar that tells Coco/R if a
string matches a bad identifier pattern, the compiler prints "Bad identifier"
using the console.
Are there better ways to achieve this?
Return to the
Search the comp.compilers archives again.