U
user923005
<snip>On 19 Jun 2008 at 21:27, vaib wrote:
i am trying to build a parser in ANSI C .
Check out yacc (aka bison).
Look up Recursive Descent Parser and try something simpler
than C to start with. Maybe a subset of C.
yes Nick i got your point - do simpler things first and then move ontoYou may know more about parsers than I (not hard)
but specifing the grammar as reg exps sounds odd to me
Why not modified Backus Naar? See the appendix in K&R
for a C grammer.
From the grammar a RDP should follow in quite a
straitforward manner.
Beware C [has] some tricky corners (eg. typedefs).
more complex issues . i was now thinking of using yacc first and i'm
reading 'lex and yacc' for that purpose . yes now i know that i'll
write a simple grammar in Backus Naur from and then make a recursive
descent parser for the same . but can u tell me how to do it
exactly ?? and no , i dont know about parsers more than you ( or
anybody else for that matter - i'm just a beginner )
first hit:
http://en.wikipedia.org/wiki/Recursive_descent_parser
it has code as well
Or even
http://www.google.com/search?hl=en&q=yacc+c+grammar
which gives over 37000 hits.