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

Re: Some more debconf queries



Eray Ozkural <erayo@cs.bilkent.edu.tr> writes:

> Well, using scheme/lisp expressions is daunting. The MacOS X people
> are using XML for the task but IMHO, that's even crazier.

Well, personally, I think that these dayas xml is the only current
viable (though much more complex) alternative to something like lisp
forms if you want something flexible since it's there, and I've heard
the parsers are readily available.  AFAIK it's sill another wheel
re-invention, but it's one of those buzz-words these days.

>   * class based language

But you're now writing another language, another syntax, and another
parser, and it's bound to be more complex than scheme.  Note that here
when I say parsing, I'm talking about the mechanical process of
getting what you wrote from disk into a set of data structures you can
manipulate from a programming language.  That does not, and should not
AFAIC, have *anything* to do with the semantic content of those forms.
That's for a higher level process to analyze.

My observation has been that "rolling your own" language is trickier
than most people realize going in.  As the complexity of your spec
grows, without automated help, it can be really difficult to make sure
you don't specify a mathematically unparsable, or at least very hard
to parse, language.

It's hard to beat scheme's simple rules (this isn't quite complete,
but captures nearly all the language):

  1) Everything is a list or an item.
  2) Every item is a list or one of a few well-specified types:
       char, string, number, symbol, etc.
  3) A list is either empty () or it contains items (a b c ...)

(this leaves off vectors, but they're conceptually just another type
 like lists)

That's it.  Deciding what you're "config language" should look like is
then just a matter of deciding what list structures are "legal" and
writing a fairly trivial recursive descent function to traverse them.
If you want to allow fancy inheritance, etc for your semantic
structures, then fine:

  (some-config-option
    (parent-class some-class)
    (config-file "/etc/myprog/foo.conf"))

And reading in your config file is accomplished with nothing more than
a series of "read" calls.

Anyway, I didn't mean to be suggesting this as anything that'll ever
actually happen, I'm just a little amazed that people are willing to
spend as much time on doing things the hard way as they seem to be.

I'll shut up now.

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930



Reply to: