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

Re: Comments on parsing steps:




I agree that we are beyond the simplest of operator precedence parsers,
thats why I have been calling it an ``augmented operator prrecedence parser''
in which a few new reduction rules have been added to the basic ones needed
for basic prefix, infix and postfix operators. For instance to build
compound terms for pairs of operators with equal precedences and to infer
invisible operators between adjacent identifiers. There is the possibility
that metamath will need the ability to add further such reduction rules
for special kinds of parse tree nodes.

> >> Are you saying that '&bold' will always grab the *token* to the right,
> >> independent of what a parser might normally do?
> >
> >This would be an easy thing to explain and to learn.
> 
> Except it probably isn't true.  Eg, what about '&bold &big x'.
> This would change the rule to be "it grabs the token to the right,
> unless the token on the right is a (prefix?) embellishing operator,
> in which case....".

Embellishments play two common roles in natural languages:

    adjectives acting on nouns   i.e. identifiers or compound terms
    adverbs acting on verbs      i.e. operators or embellished operators

This seems both natural and easy to understand. We are all comfortable
with nested application of adjectives and adverbs:

    The fast red fox quickly flees from the crazed hunters

where fast and red correspond to embellishments on the `identifier' fox,
and "flees" is an embellishment on the `operator' flees.

> Although I am always in favor in coming up with a design that allows
> people to type the intuitive thing in, I am much more in favor of something
> that can be described on paper in a fairly clean manner.  This makes
> different implementation more likely to implement the same language
> and allows for readers to figure out what they should do, when something
> doesn't work the way they expect.  When clean description and intuitive
> use both exist, you know you have a winning design.

I agree that embellishments need to be clean and I don't understand
why parity breaking is called for. The operator precedence mechanism
is symmetrical for left to right and right to left. Why is it that
prefix embellishments are any different from postfix embellishments?
Is it just the dual roles of `+' and `-' as prefix and infix ops?

-- Dave Raggett <dsr@w3.org> tel: +1 (617) 258 5741 fax: +1 (617) 258 5999
   World Wide Web Consortium, 545 Technology Square, Cambridge, MA 02139
   url = http://www.w3.org/People/Raggett


References: