|
From: Baptiste L. <gai...@fr...> - 2004-02-15 21:44:59
|
Added some basic template support and fixed a serious bug (pointer were =
not allowed as function return type). It is now possible to have =
template declaration (class, function).
The CppParserTest::testTranslationUnit() test is a good place to start =
playing with the parser. It contains a few code snippet. If you want to =
see the produced ast, change the assertion macro to =
CPPPARSER_ASSERT_TREE and add a dummy testNode("").
Baptiste.
----- Original Message -----=20
From: Baptiste Lepilleur=20
To: CppTool Mailing List=20
Sent: Saturday, February 14, 2004 9:53 PM
Subject: Re: [Cpptool-develop] C++ parser progress...
Port finished and error recovery added. Uploaded at the same place.
I'll try to enhance the template support before moving back to the =
nodetracker.
Baptiste.
----- Original Message -----=20
From: Baptiste Lepilleur=20
To: CppTool Mailing List=20
Sent: Saturday, February 14, 2004 11:13 AM
Subject: Re: [Cpptool-develop] C++ parser progress...
Well, I've ported the expression parsing. After a rough start (some =
bug that went unoticed before in the grammar builder), I'm now =
progressing quickly (about 25% of the port is done).
The most recent version can be found in:
http://gaiacrtn.free.fr/backup/
just peek the most recent version of cppparser.
Interesting stuff to look at are in examples/parser.
cpp_grammar.txt: the grammar
cppparsertest.cpp: the unit test for the grammar
nodetracker.cpp/nodetrackertest.cpp: proof of concept for ast =
modification that automatically update the source
parser.h/parsercontext.h: parsing framework
commandstream.cpp/commandstreamtest.cpp: converts the parser =
production into an ast.
Baptiste.
----- Original Message -----=20
From: Baptiste Lepilleur=20
To: CppTool Mailing List=20
Sent: Monday, February 09, 2004 11:13 PM
Subject: [Cpptool-develop] C++ parser progress...
Some news about the C++ parser I'm working on...
I've ported the core parser framework to C++. I've also =
decided to abstract the grammar away in a text file instead of =
executable code. This greatly improve grammar readability and avoid some =
mistakes that can easily be made when writing grammar in C++ (or python =
for the matter). This will also make the grammar much less sensible to =
change of the actual implementation of the parser (which I can see that =
evolving a lot).
I'll tackle the actual port the C++ grammar written in python =
to C++ soon. I'm still undecided on weither I should also abstract the =
unit test into text file or having them in code...
I have implemented a proof of concept of 'update the AST and =
get the modified source'. It handles insertion and removal of node =
(which can be composite node). It currently assumes the a depth first =
traversal of the ast tree will process the token node is the 'source' =
order. Giving a quick look at the python unit test, I didn't see this as =
being a false assertion (It can be worked around if need be, but it =
would complicate things a lot).
If a preprocessor was postprocessing the lexer tokens, it =
could tag macros parameter occurrence as special 'token'. That way, when =
renaming that token we could detect that it is an actual macro parameter =
occurrence and renaming should be done at the macro call. This would =
allow dealing with a lot of macros occurence (for example renaming a =
method present in a CPPUNIT_TEST macro).
=20
A snapshot of the sources is available at:
http://gaiacrtn.free.fr/backup/CppParser-20040209-22h30.rar
It includes VC++ 2003 projects, cppunit 2, boost and =
precompiled regex librairies for VC++ 2003.
Baptiste.
|