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

Translation of EBNF ops?




Dear Etienne and other SableCC guru's,

I'm interested in how SabelCC transforms the EBNF operators to BNF
constructs. Its not totally clear to me after reading Etienne's thesis.

From the numbered list on page 48 my impression is that:
* a -> c b? d
    is translated to
  a -> c b d
    |  c d

* a -> c b+ d
    is translated to
  a -> c t d
  t -> t b
    |  b

* a -> c b* d
    is translated to
  a -> c t d
    |  c d
  t -> t b
    |  b

Is this correct so that for example
    a -> b+ c?
     would be translated to
    a -> t c
      |  t
    t -> t b
      |  b
?

But then I'm confused on the next page where it says:
"We have learned, by experience, that the obvious implementation for (?),
by creating a new production (temp = x | ;) causes more LALR(1) conflicts
than our current implementation". But isn't that exactly what is done? Or
do you mean that (a -> c b? d), in this latter scheme, would be
translated to (a -> c t d) and (t -> b | ;)? 

Regards,

Robert