help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Need 'UncommentAndSetValue' or some such


From: Luke Kanies
Subject: RE: Need 'UncommentAndSetValue' or some such
Date: Fri, 28 Oct 2005 08:52:15 -0500 (CDT)

On Fri, 28 Oct 2005, Mark Burgess wrote:

> I don't want everyone to see it yet!! I don't want a huge discussion
> about it from people who turn to the last page without reading the full
> thing, and then having to defend everything by email :-)

That seems an odd choice, given that cfengine does now have a pretty strong
community of users who would really like to contribute.

> > I hope that the cfengine 3 language syntax will be completely LALR(1)
> > specified and, so, completely parseable by YACC/LEX.  I think it would make
> > the language easier to understand.
>
> That's missing the point. Cfengine is as parsable in lex/yacc now. The
> reason that some things like functions are saved until later has to do
> with the way it has evolved from the beginning. There is no data model
> that could replace functions with a compiled form, so you could not
> handle functions at parse time. This has nothing to do with the grammar,
> it has to do with the "stupid" way cfengine mixes parse-time and
> run-time evaluation. That needs a much deeper fix than a different
> parsing strategy.

While cfengine does currently _use_ lex and yacc, it is not entirely parsed
that way.  In particular, class tests and variables are not handled in the
grammar -- i.e., strings like 'test|other::' and '${variable}' are matched as
strings but are not interpreted in the grammar.  This fact, and especially
the variable difference, does cause problems.

I agree that the way in which cfengine mixes parse-time and run-time does
make it difficult to use.  If all functions picked a time to run and only
ran at that time, it would certainly make things more consistent.

I have to say that if you're going to completely rewrite the parser, I
highly recommend moving to a more traditional parsing style, where the
lexer is very minimalist and is just responsible for token matching, and the
parser does all of the object creation.  I know it's possible with cfengine,
although it might require some tweaks to the language, and doing so would
make the language side of the equation much easier to understand and
maintain.

-- 
Really?  He might do it just for fun.  I know I would.  If I were God,
I'd get together with all my other God friends and have a big party.
We'd all get drunk and create unliftable rocks, then try to lift them.
It would be loads of fun!  Then I'd probably just destroy the rocks
with a lightning bolt.  Then I'd probably pass out.  :^)
                -- toMM, in rec.puzzles
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]