Parser

Pau Estalella pau.estalella at upcnet.es
Wed Feb 16 12:25:50 GMT 2000


Jonas Nordin wrote:

> > Wouldn't it be easier to use bison++, instead of hardcoding the parser in
> > C++?
>
> I would say no. If we should use bison/yacc or some other component like
> that we would more  or less need to implement a full C++ parser. Since it is
> only delarations and function headers we need to parse, that is overkill.

No way. You don't have to parse to the very detail. To parse the
implementations
you would have to use something like:

FunctionImpl --> Header '{' CodeLines '}'
Header --> String '(' Arguments ')'  /* Here you catch the func name &
arguments */
CodeLines --> CodeLine ';' CodeLines |
                              '{' CodeLines '}'        /* For code blocs */

CodeLine --> /* do nothing */

No much more than this level of detail. See what I mean?

Pau Estalella.





More information about the KDevelop mailing list