Lexical Analyzer and parser for C/C++

Posted on 2004-11-03
Last Modified: 2008-02-01
I need lexical analyzer and parser that deals with our own language. lexical and parser can be in c/c++.

keywords will be our own like for int, myint and for char, mychar and so on


Question by:zeeshansaleem
    LVL 12

    Accepted Solution

    I really like the one from, and it's only $60. An O-O implementation of lex and yacc, basically.

    LVL 22

    Assisted Solution

    Try googling "tiny c compiler source".  You'll find lots of hits.  OF COURSE do NOT just steal the source... look it over and get the general idea of how it's done, then write your own.

    BTW watch out:  there's two ways to do it:  doing all the lexical stuff yourself, or using tools like lex and/or yacc to do some of the work.  Make sure you choose the correct path before starting out!

    LVL 2

    Assisted Solution

    Refer to this site.
    It has lexical analyser and parser sample code. Very helpful.

    Assisted Solution


    Spirit is a C++ templates library that can be used to implement language parsers.
    It is a very good tool (a bit involved though).

    LVL 12

    Expert Comment

    PAQ it at least. Don't delete!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
    Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now