lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Here's a start on a C parser.  Mostly useful for lists of expression
statements without things like structs, or branching/looping code:


On Sat, Sep 19, 2009 at 11:31 AM, David Manura <> wrote:
> On Fri, Sep 18, 2009 at 8:48 AM, Peter Cawley wrote:
>> You might be interested in reusing some code I wrote recently. It is a
>> Lua/LPEG creation to parse C++ source files, extract information, and
>> then output it in wiki markup.
> For comparison, there's another LPeg-based C tokenizer at [1].  There
> may be some issues using a C tokenizer as is on C++.  For example,
> '::' is a C++ only token.  Peter's supports that (mine doesn't) though
> doesn't appear to specially mark C++ keywords like 'try' and 'class'
> for example.
> Reliably parsing, not just lexing, C++ is no small feat.  gccxml was
> discussed previously on this list [3].  See also [4].  Using the xml
> output option from Doxygen may be a fairly accessible solution that's
> good enough.
> [1]
> [2]
> [3]
> [4]