|ANSI C Yacc grammar firstname.lastname@example.org (2001-10-20)|
|Re: ANSI C Yacc grammar GOLDParser@DevinCook.com (2001-10-23)|
|Re: ANSI C Yacc grammar email@example.com (Axel Kittenberger) (2001-10-23)|
|Re: ANSI C Yacc grammar firstname.lastname@example.org (2001-10-27)|
|Date:||20 Oct 2001 21:52:46 -0400|
|Keywords:||C, parse, question, comment|
|Posted-Date:||20 Oct 2001 21:52:46 EDT|
I would like to make some kind of a translator for the C language, and
therefore I have looked at the C grammar in the K&R book and a yacc
grammar of Jutta Degener on:
I noticed that the above mentioned grammars are not very restrictive,
as they accept input which is not legal ANSI C, like:
register int main()
int main(int, int *, int)
int main(char a)
Why is this input accepted ? Is it not possible to write a grammar
which is more close to the ANSI C syntax ? I understand that a yacc
based grammmer could not do things like type checking and parameter
checking etc, but a better syntax checking seems possible to me.
[I find that I can generate much better error messages by accepting
a larger language in the parser and then rejecting the excess later.
Return to the
Search the comp.compilers archives again.