Re: wanted: error-correcting C parser

grosch@cocolab.sub.com (Josef Grosch)
Sat, 18 Feb 1995 20:17:45 GMT

          From comp.compilers

Related articles
wanted: error-correcting C parser keller@trurl.informatik.uni-dortmund.de (1995-02-13)
Re: wanted: error-correcting C parser umrigar@cs.binghamton.edu (Zerksis D. Umrigar) (1995-02-15)
Re: wanted: error-correcting C parser grosch@cocolab.sub.com (1995-02-18)
Re: wanted: error-correcting C parser parrt@parr-research.com (Terence John Parr) (1995-02-20)
| List of all articles for this month |
Newsgroups: comp.compilers
From: grosch@cocolab.sub.com (Josef Grosch)
Keywords: parse, errors, tools
Organization: CoCoLab, Karlsruhe, Germany
References: 95-02-114
Date: Sat, 18 Feb 1995 20:17:45 GMT

Robert E. Keller (keller@trurl.informatik.uni-dortmund.de) wrote:
: I'm looking for a parser which understands C ... and which, if it encounters a syntax
: error, delivers a set of all those tokens/symbols which are correct
: in place of the wrong symbol ...


and our moderator added:
: [... WHen the question of C error detection last came up, the
: consensus seemed to be that coming up with the set of possible next tokens is
: fairly easy in a top-down parser, nearly impossible in something like yacc. ...]


Parsers generated by the parser generators Lalr and Lark of the Cocktail
Toolbox do exactly what Bob wants. Lalr has been around now for several
years showing that it is possible to do it in contrast to the opinion
summarized by the moderator. Btw, the error messages are emitted
completely automatic without the need for any error tokens or extra
grammar rules.


Example messages using the following input:


: extern short c;
: int fnc(int a, int b){return a+;}


with truncation:


2, 32: Error found/expected : ;/IDENTIFIER ENUMERATION_CONSTANT ...


without truncation:


2, 32: Error found/expected : ;/IDENTIFIER ENUMERATION_CONSTANT
CHARACTER_CONSTANT FLOATING_CONSTANT INTEGER_CONSTANT
STRING ( * ++ -- & + - ~ ! sizeof


in verbose mode:


2, 32: Error syntax error
2, 32: Information token found : ;
2, 32: Information expected tokens: IDENTIFIER ENUMERATION_CONSTANT CHARACTER_CONSTANT
FLOATING_CONSTANT INTEGER_CONSTANT STRING ( * ++ -- & +
- ~ ! sizeof
2, 32: Repair token inserted : IDENTIFIER


: rumour has it that such generators could be found under
: ftp.eb.ele.tue.nl:/pub/src/cocktail.*,
: but this archive has been removed;


You might try ftp.rus.uni-stuttgart.de:/pub/unix/programming/compilerbau
instead which stores the '92 version 9209. Newer versions are commercial
products.


Josef Grosch


Hagsfelder Allee 16
D-76131 Karlsruhe
Germany


Tel.: +49-721-697061
Fax : +49-721-661966
Mail: grosch@cocolab.sub.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.