bug-global
[Top][All Lists]
Advanced

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

parser improvement suggestion


From: asmwarrior
Subject: parser improvement suggestion
Date: Wed, 08 Jun 2011 11:21:48 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.0

Hi, I have briefly review the code
global-5.9.6\libparser\Cpp.c

It seems the parser was quite limited on parsing c++ language.

Here are my suggestions:

take some reference:
1, ctags
2, codeblocks' parser
3, clang/qtcreater...

I have a collecting on
Code Completion Design - CodeBlocks - http://wiki.codeblocks.org/index.php?title=Code_Completion_Design See its last chapter, I have list a lot of parser reference. (most of them were GPLed project)

About the full stage:
lexer
preprocessor
parser

I think a full preprocessor is not necessory, but a lexer is necessory, I have try to rewrite the code::blocks' parser by using Quex lexer, this will make your parser code clean and easy to learn.

See my personal parser project:
http://code.google.com/p/quexparser/

Mostly, I think you need to use the "recursive decent parser", so you create a lot of functions like:
HandleClass();
HandleNamespace();
HandleWhile();

You can see my code:
http://code.google.com/p/quexparser/source/browse/trunk/cppparser/parserthread_test.cpp

The code should be easy to read.

For this kind of bug:
http://lists.gnu.org/archive/html/bug-global/2011-05/msg00000.html
I think you can add some simple replacement rule to skip Some user defined words in the lexer/preprocessor stage.
This is much like the ctags -I option.


Finally, I'm grad to see the gtags project and hope it will becomes mature in the future.

asmwarrior
ollydbg from code::blocks' forum



reply via email to

[Prev in Thread] Current Thread [Next in Thread]