home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,555 of 2,753   
   Hans-Peter Diettrich to John Williams   
   Re: How to improve the error handling of   
   13 Jan 09 03:58:25   
   
   From: DrDiettrich1@aol.com   
      
   John Williams schrieb:   
      
   > 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:   
   >   
   >    MODULE Program;   
   >        VAR 4fgnn : INTEGER;   
   >    END Program.   
   >   
   > 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.   
      
   It's a matter of your grammar, what errors can be caught in which places.   
      
   When "4fgnn" is scanned as a number and an identifier token, no rule   
   should exist that accepts a sequence of "VAR" .   
      
   DoDi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca