help-bison
[Top][All Lists]
Advanced

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

Re[2]: Which one is "better" ?


From: Baldurien (club internet)
Subject: Re[2]: Which one is "better" ?
Date: Sun, 31 Jul 2005 18:03:00 +0200

Bonjour Hans,

Le dimanche 31 juillet 2005 à 11:27:43, vous écriviez :


HA> On 31 Jul 2005, at 01:07, Baldurien (club internet) wrote:

>> I  have  a  grammar  to do for my self, and since this grammar add the
>> same  expression  than  the one we could have in a SQL query language,
>> I'm wondering which grammar is better in term of performance.
>>
>> My first one is the classical "one production per precedence" :
HA> ....
>> With %left, and %nonassoc (and %right too) it give this :

HA> There is no big practical difference between these two methods, as
HA> a  typical compiler spends most time in the actions and the lexer.
HA> So  choose  the  method  you  are  most  comfortable  with.  Using
HA> precedence  rules %left, etc. produces a more compact grammar that
HA> is  also  more  structured,  which  might  help human programming.
HA> Otherwise,  using precedence rules cuts down the number of states,
HA> so   that   parser  will  be  somewhat  faster;  the  transitions,
HA> independent  of  number,  are put in a lookup array, so the number
HA> does not affect parser size.

HA>    Hans Aberg

Oki  doki for that point. I will use precedence rules (since I find it
easier to work with).

Now,  I'm  asking  myself  about  how  bison  store the grammar in the
produced parser :

In  class  I've  seen  how  to  construct  the  LL(1)  table,  and the
transition  table  for  the  automata,  but since I've seen it only on
paper,  I don't know how I could efficently store this like Bison does
?

(Since I would like to "translate" the C parser into a PHP one).





-- 
Cordialement,
 Baldurien                            Courriel : address@hidden





reply via email to

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