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: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: XML (OT)
From: Andrew Sutton <ansutton@xxxxxxx>
Date: Friday, 07 Dec 2001 12:28:52 -500

Originally to: David B. Smith


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).

> > actually, on a side note flex isn't even 
GNU or being actively
> > maintained. i don't know about bison.
>
> That matters?

that's why it was a side note.

> > 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.

> I would maybe use XML, depending on the 
style of the language. If it's only
> config file, I wouldn't use it, as it's 
pretty useless then, IMHO.

i'd disagree here... if its just data, XML 
would probably be a better idea 
for the simple fact that it's meant for that 
and its widely supported. 
however, as soon as you want to introduce 
something a little more complicated 
like functional specifications, XML kind of 
sucks. the only exception would 
be the embedding of a scripting language in 
the XML specification - which 
could be pretty useful.

anyway, this is getting pretty far off topic 
now :)

andy



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