[Posted and mailed]
#>
#> >Greetings !
#>
#> >Does anybody know where can I get (preferably for free) a lex scanner
#>
#> >specification
#> >along with a compatible do-nothing yacc grammar for ANSI C ?
#>
#> Check the C FAQ - 18.15 contains pointers on what you want.
#>
#> http://www.eskimo.com/~scs/C-faq/top.html
#>
#> David.
# Thanks David for the useful link. I've found a parser and lexer at:
# ftp://ftp.uu.net/usenet/net.sources/ansi.c.grammar.Z
Yosseff,
note that the companion lexer from the same place is not complete
(in the sense that it won't parse most nontrivial C code). This is
due to the check_type() function, which is hairy to implement.
As is, if the lexer finds an identifier, say in
...
struct foo { foo foo; } foo;
it needs to return TYPE_NAME for the 2nd foo, and IDENTIFIER
for the others. This is not implemented -- it'll always return
IDENTIFIER which leads to syntax errors for most inputs.
Does anybody else know of other lexer/parser combinations
that handle this correctly? I've looked at the gcc sources
and found them to be way too inaccessible to be modified for
that purpose.
Regards,
Jens
--
Jens Schweikhardt http://www.shuttle.de/schweikh/
SIGSIG -- signature too long (core dumped)