Hi!
I admire your knowledge, cause I didn't have had the change to use lex
outside of university. At university I just was capable to finish a
little compiler in about 1 week of hard work (using lex, yacc, ox, and
i-burg). (actually I am still studying at the Technical University of
Vienna)
So I won't dare to say anything against your base of knowledge since my
knowledge isn't able to compete with yours.
So I only was woundering why you did what you did.
I think my questions for this topic are answered yet.
kind regards, +43-676-4708155
Michael Moerz Systemengineer +43-1-718-98-80
CUBiT www.cubit.at
On Thu, 9 Dec 1999, Alan Robertson wrote:
> Michael Moerz wrote:
> >
> > Hi!
> >
> > I have read config.c and I wounder why flex and yacc are not used for
> > parse the configuration-files. I suppose that writing that stuff in flex
> > would not only make the source better readable, but also easier to modify
> > and extendable.
>
> Because it is about 100 times overkill, and the lex/yacc code would not be much
> smaller (in source). Also, there are lots of different gotchas in using lex and
> yacc (like the inability to handle more than one grammar in a given program)
> that I didn't want to try and overcome with in this situation. Additionally,
> given the simple syntax of the config file, it would actually be *less* readily
> extended in many useful ways than the current code.
>
> I wrote the current code in about an hour. Lex/Yacc would have probably taken
> longer, and been impossible to add more file types to parse, and the resulting
> code would have been MUCH bigger in object form, and similar in source size.
>
> Other than that, I didn't have any particular reason :-)
>
> Readability in something like this depends on knowing the "patterns" of lexical
> analysis in C. If you're familiar with the normal patterns for this, the code
> will be readable. If you're only familiar with using lex and yacc, it probably
> won't seem clear to you.
>
> I have written several dozen parsers of varying degrees of sophistication, and
> many of them used lex and yacc. My engineering judgment was that this structure
> was cleaner and better suited to our needs.
>
> I admit that the code for parsing authkeys needs help. I didn't modify that
> part of the code enough after I got it. Laziness on my part, I guess.
>
> As we go forward and try and build a more sophisticated (multi-node) cluster, it
> *might* be the case that our situation might change and rewriting it might be
> better than adding a little to it.
>
> -- Alan Robertson
> alanr@bell-labs.com
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.tummy.com
> http://lists.tummy.com/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>