Re: Simple parser for C/C++



Helmut Giese kirjoitti:
On Fri, 28 Sep 2007 19:11:35 +0300, Esa Heikkinen
<esa.heikkinen@xxxxxx> wrote:

Hi

How easy would be make simple parser for C/C++ by tcl ?

I would want to make tcl-script, which searchs all functions/methods and entry/exit points of functions/methods from C/C++-source file.

I think this should be possible, but i don't know how.
Hi Esa,
Michael already directed you to the page on the wiki which is probably
the best starting point for parsing C.

As for C++, there is no such thing as a "simple parser". Think of
classes, function and operator overloading, namespaces and - the most
terrible of all (in terms of parsing) - templates.
Just my 0.02
Best regards
Helmut Giese


Ok .. i understand, but i think it would be exist simpler way to detect only things i want. I don't want to parse all code. Maybe i do not need parser at all ?

Maybe i can do that by "regexp" or "string match" by investigating many rows of code at same time ?

I only want to detect row numbers of certain things (what i described before).


---
Esa
.



Relevant Pages

  • Re: Simple parser for C/C++
    ... I would want to make tcl-script, which searchs all functions/methods and ... terrible of all (in terms of parsing) - templates. ...
    (comp.lang.tcl)
  • Re: OFF-TOPIC:: Why Lisp is not my favorite programming language
    ... The interpreter would be written in C. ... It is always possible to beat any interpreted language for speed using ... >at me for calling lisp a parsing language... ... I would write a parser to do so. ...
    (comp.lang.python)
  • Re: "Intro to Pyparsing" Article at ONLamp
    ... and then construct the corresponding grammar parser. ... > With data-driven parsing, you are starting with data to be parsed, and you ... I'd like to add another parser type, lets call this a natural language ...
    (comp.lang.python)
  • Re: What is the fastest method of parsing scheme?
    ... Recursive descent parsing is O, ... used to compile the parser, and the hardware used to run ... has been about performance of compilers and interpreters: ...
    (comp.lang.scheme)
  • Re: how to store list of varying types
    ... The cost of parsing what is essentially a "flat" structure is ... I wrote an XML parser from scratch for a complex nested structure in six ... you are superior of the "average programmer". ...
    (microsoft.public.vc.mfc)