On 05/04/12 12:42, Jeffrey Kegler wrote:
> Alberto Simões and I have been talking, in connection with an article he
> would present at SLATE '12 in Braga, Portugal, about precedence. That is,
> some people prefer to write the grammar
>
> E ::= E + T
> E ::= T
> T ::= T * F
> T ::= F
> F :: number
>
> as
>
> E ::= E + E, precedence = '+', associativity = left
> E ::= E * E, precedence = '*', associativity = left
> E ::= number, precedence = 'term'
>
> and then specify that the precedence from highest to lowest is 'term', '*',
> '+'. This is how the Perl expression syntax is described in the perlop man
> page, and the precedence form is more convenient than the pure BNF when
> expressions get very complicated. I believe the transformation from the
> precedence form to the pure BNF form that Marpa::XS accepts can be done
> mechanically.
That sure looks labourious to construct. I hope the current syntax will
continue to be supported even if you allow the above to be used.......
--
Ron Savage
http://savage.net.au/
Ph: 0421 920 622
[rule] as alternative to rule{0,1}.
--
Best regards, Ruslan.