Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
1.50/5 (5 votes)
See more:
I want to develop a c program parser. Where I can find information and the source code for it? The code must be in lex or c or c++...
Posted
Updated 5-Dec-10 21:19pm
v2
Comments
Manfred Rudolf Bihy 5-Dec-10 6:11am    
Are you sure you know what you really want? Lexers (such as lex or flex) don't do any parsing for you, they tokenize text into parts that are then used by a parser like bison or yacc.
Sandeep Mewara 5-Dec-10 7:32am    
No effort

Hi,
You will find a C++ written mini-c C parser sample at <Boost>\boost_1_45_0\libs\spirit\example\qi\mini_c in Boost Spirit[^] after downloading the Boost Library[^].
cheers,
AR
 
Share this answer
 
Google.

A quick search with your subject as the search term gave loads of examples. Ok, you will have to decide which does exactly what you want, but that is the nature of research. Note the term: research. The implication is that you try to do some of the research yourself...
 
Share this answer
 
govindray wrote:
I want to develop a c program parser.

Nice intention, but be aware: the task is not simple.

govindray wrote:
Where I can find information and the source code for it?

This is in sharp contrast with the former, noble sentence. You're a developer, right? Hence study (almost every parsing textbook, shows how to do some - at least minimal - parsing of a C language grammar subset) and then try to develop your own parser.
:)
 
Share this answer
 
Comments
CPallini 6-Dec-10 3:18am    
Thank you, Mr Univoter.
Manfred Rudolf Bihy 6-Dec-10 3:41am    
Some people seem to be pissed off easily when they're being told to actually do some work :) . Have my 5 instead!
CPallini 6-Dec-10 5:50am    
@Manfred: I know and I shouldn't complain. Anyway, sometimes I can't resist. In any case, thank you very much.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900