On Sun, 5 Nov 2000 [EMAIL PROTECTED] wrote:

> In reply to Stefan Seefeld <[EMAIL PROTECTED]>
> 
> >Most terminal programs I'v looked into are awefully messy, mostly
> >because they don't separate the graphics from the tty and the parser
> >properly. This cries for a good object oriented design ! 
> 
> 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.

Only problem with ANTLR in our context: it generates C++ (or Java), as
opposed to CWEB which generates C (and documentation). If you need to
stick to C, maybe ANTLR predecessor could be useful (named PCCTS).

Also, this is a code-generator so, maybe you do not like the approach. But
if you ever intended to generate a parser by hand -- even a simple one --
have a look at ANTLR first and enjoy full EBNF syntax.

Rodolphe

Reply via email to