|
From: Baptiste L. <gai...@fr...> - 2004-02-09 22:14:02
|
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.
|