Third iteration of QMake parser, looking for a parser generator

Roberto Raggi roberto.raggi at gmail.com
Wed Jul 4 20:56:35 UTC 2007


Hi!

Il giorno 04/lug/07, alle ore 21:20, Andreas Pakulat ha scritto:

> On 04.07.07 17:29:35, Alexander Dymo wrote:
>> I really think you should be using kdevelop-pg and hand written /  
>> flex
>> lexer because kdevelop-pg is something which we can improve.
>> Concerning AST, I don't think you'll get that bad AST for qmake
>> projects. In anyway, somebody has to do smth with the AST at some
>> point because we already have python and ruby and c# and java parsers
>> using kdevelop-pg and needing that.
>
> Why is everybody so eager to get me to use kdev-pg?
I'm with you. I really think you should use whatever tool you want,  
but I also think that external dependencies are annoying (think about  
boost).

>
> Anyway, so I sat down and wrote up a simple, non-functional, but
> ast-demonstrating parser for kdev-pg. Guess what: The generated AST is
> not usable. I don't see why I should need to keep the token-stream

I think it is still supported, but you need to check with the  
KDevelop guys, kdev-pg has an option to disable the auto generation  
of the AST. You should be able to write

-- cool.g
%token ROBERTO, IS, AWESOME ;;

a:ROBERTO b:IS c:AWESOME -> goal [: do something with a, b, and c  
here :] ;;

then you write kdev-pg --no-ast --output=cool file.g


> around after parsing, but I'd need to do that because the AST only
> contains std::size_t for any token that is matched (like variable  
> names
> for example). Also there are some indirections in the AST which are
yeah, I like to think that it is a feature :-)

> useless. So I'd have to write a visitor that transforms the
> generated AST in a usable one.
there is nothing wrong with that.. A lot of front-ends I know have  
more than one intermediate format. AST, simplfiied AST, public  AST,  
IR, .. and trust me converting ASTs is not a big deal.

>
> Instead I think I'll write up a attributed grammar for Coco/R where I
:-)

ciao robe





More information about the KDevelop-devel mailing list