|ANSI C Yacc grammar email@example.com (2001-10-20)|
|Re: ANSI C Yacc grammar GOLDParser@DevinCook.com (2001-10-23)|
|Re: ANSI C Yacc grammar firstname.lastname@example.org (Axel Kittenberger) (2001-10-23)|
|Re: ANSI C Yacc grammar email@example.com (2001-10-27)|
|Date:||23 Oct 2001 20:24:24 -0400|
|Posted-Date:||23 Oct 2001 20:24:24 EDT|
> 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.
The syntax of the grammar is very, very different from the semantics
of the programming language. It may possible to define a grammar which
restricts the syntax in functions called 'main' as well as attempt to
remove all other semantic issues, but the grammar would become far too
complicated for practical use with YACC, the GOLD Parser, JavaCC or
any other parser generator.
For problems like this, it is better to test for semantic problems
after the initial parsing is complete and the program is stored in the
I have another version of the C grammar on my website, if you are
Anyway, I wish you well on your project.
- Devin D. Cook
Return to the
Search the comp.compilers archives again.