Rodolphe Ortalo wrote:
> > actually, this cries for a good code design, and that's about it. the
> > emulator i'm writing has everything pretty much separated --- not in
> > the final C file itself, but in the CWEB source code. that's one of
> > CWEB's beauties, the fact that you don't have to obey any order
> > whatsoever (take a look, for example, at dviv.dvi to see what i mean).
>
> CWEB ? Hmmm, still some Knuth-ian influence at Stanford ? ;-)))
:)
> Anyway, concerning the generation of an object-oriented parser, maybe
> Stefan would like to have a look at http://www.antlr.org/ for a wonderful
> tool for lexer/parser/tree-parser generation (I mean it: try it and you
> will think that lex/yacc or flex/bison was a horrible nightmare -- maybe
> it is). ANTLR has some very nifty features, most notably the ability to do
> "grammar inheritance", which may be useful when building serveral similar
> parsers with common characteristics, like for terminals.
well, I think for terminals a full fledged parser framework is a bit heavyweight,
don't you think ? Each parser has a simple grammer to know about, so I think
a simple table or even regex based one would be ok. (Each concrete parser could
use its own method, all that is necessary is that all parsers provide a unified
abstract interface to the stream, or vice versa).
With respect to antlr, I already had a look at it. Do you have any experience
with it ?
I'm asking since I started a source code analysis tool
(http://Synopsis.sourceforge.net)
and I'm looking into openC++ as a C++ parser front end, but I'm only partly
successful. Can you provide some hints as to how to build a C++ parser with
antlr which is able to produce an Abstract Syntax Tree ? Or is the C++ grammar
too complex for a general parser framework ?
My main goal with Synopsis is to produce documentation, but even source code
navigation tools should be possible...
Regards, Stefan
_______________________________________________________
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: [EMAIL PROTECTED]
_______________________________________________________
...ich hab' noch einen Koffer in Berlin...