cfengine-develop
[Top][All Lists]
Advanced

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

Re: [Cfengine-develop] New Parser/Lexer PoC


From: Andrew Stribblehill
Subject: Re: [Cfengine-develop] New Parser/Lexer PoC
Date: Mon, 31 Mar 2003 12:51:33 +0100
User-agent: Mutt/1.5.4i

Quoting Mark Burgess <address@hidden> (2003-03-31 11:06:10 BST):
> 
> > So, with no further ado, you can find the lexer and parser here:
> > 
> > http://madstop.com/~luke/cfengine/cflex2.l
> > http://madstop.com/~luke/cfengine/cfparse2.y
> > 
> > They aren't terribly well documented, either.  I can do so if people
> > think this is a worthwhile experiment to explore, but I don't want to
> > spend much more time on this if it's just going to be thrown away
> > (which is what I expect to happen).
> > 
> > Enjoy!
> > 
> > Luke
> > 
> 
> 
> A little while ago, Luke proposed a new form for the parser.
> Does anyone have any comments on this?

It's nice and simple, but I'm not sure it's scalable enough.

I should like to see almost all actions coded as plugins to the main
Cfengine system. This way, the ACL module, for example, never need be
built for those not wishing to use it. More importantly, it would
provide a nice way for third parties to extend Cfengine functionally
without being too tightly bound to Cfengine's parser etc.

So I guess my question is, how could we get there from here? If
Cfengine's parser could provide a hook for each action to interpret
the parse tree, this might work, though I think the parser may end up
a bit on the basic side.

Mark has admitted that the link parsing is ugly, and it does indeed
seem to be a special case in both the lexer and the parser. So let's
drop it in Cfengine 3, to be replaced by something like:

links:
  $(srcfile) dest=$(destfile)
  $(srcdir) dest=$(destdir) farm=yes  # To do the +> thing
  $(srcdir) dest=$(destdir) force=yes # For the ! thing

Many actions have basically a single token with arguments, like the
above examples. Can we coerce the actions into two basic types: the
simple ones like above:

  something [flag1=arg] ... [flagN=arg]

and the editfiles types with the following form:

  { something
  cmd1 [args]
  cmd2 [args]
  }

-- 
FORTH TYNE DOGGER
SOUTH VEERING SOUTHWEST 4 OR 5 INCREASING 6 OR 7, PERHAPS GALE 8
LATER FOR A TIME. RAIN FOR A TIME. MAINLY GOOD




reply via email to

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