Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: XML (OT)
Home

[Freeciv-Dev] Re: XML (OT)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Andrew Sutton <ansutton@xxxxxxx>
Cc: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: XML (OT)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Fri, 7 Dec 2001 18:47:31 +0100

Dear diary, on Fri, Dec 07, 2001 at 06:28:52PM CET, I got a letter, where
Andrew Sutton <ansutton@xxxxxxx> told me, that...
> On Friday 07 December 2001 11:00 am, Petr Baudis wrote:
> > They say something about impossibility of parsing C or perl syntax by yacc.
> > Well, dunno about yacc but it's then really funny that both perl and gcc
> > use bison, isn't it? And, honestly, even when writing IMHO relatively
> > complex grammar using bison, I never got into those problems.
> 
> having worked extensively with compilers in the last month or two, i can say
> *without* doubt that there are just some grammars that yacc/bison are
> incapable of parsing. it has to do with the algorithm used to for descent.
> yacc/bison generates bottum-up LALR(1) parser - it's just insufficient for
> sufficiently complex grammars. don't forget that you can manipulate a grammar
> specification to help resolve shift/reduce, reduce/reduce and other various
> ambiguities or infite recursion issues. you can also approximate some aspects
> of the grammar thru code. so they're probably right. it may be impossible to
> parse the C and perl syntaxes as specified, but for lack of a better tool,
> they make up for the shortcomings with more complex grammar implementations
> (like a fixed token lookahead).
Erm, another question, will we make some complex grammar for our config file?
;)

> > > both cases have their weak points. xml isn't very expressive and it's not
> > > really mean to be. writing your own parser will provide a more
> > > specialized language but is going to be a pain in the ass - regardless of
> > > how easy it is or how much experience anybody has.
> >
> > I don't think so :).
> 
> alot of it is going to have to deal with specification of the grammar itself.
> it's not easy to write the perfect grammar first time out, because you're
> going to miss something. then, going back and adding might prove to be
> somewhat difficult and its possible that you could break all the existing
> scripts/files by changing a rule to accomodate your addition.
Then your change will be rejected/reverted later ;).

-- 

                                Petr "Pasky" Baudis

UN*X programmer, UN*X administrator, hobbies = IPv6, IRC, FreeCiv hacking
.
  "A common mistake that people make, when trying to design
   something completely foolproof is to underestimate the
   ingenuity of complete fools."
     -- Douglas Adams in Mostly Harmless
.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/


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