[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to change default outcome of shift/reduce conflict?
From: |
Anthony DeRobertis |
Subject: |
Re: How to change default outcome of shift/reduce conflict? |
Date: |
Wed, 16 Jan 2002 08:56:10 -0500 |
On Tuesday, January 15, 2002, at 06:56 PM, Hans Aberg wrote:
I think that rather than fiddling around with operator
precedence, you need
to figure out the correct semantics in relation with the
grammar. Compare
with the grammar
http://www.jaedworks.com/hypercard/scripts/hypertalk-bnf.html
Well, they have:
answer
<expr> [with <factor> [or <factor> [or <factor>]]]
Now, what is a factor? I quote:
"<factor> is the first fully resolvable portion of an
expression. Factors are covered in detail in Chapter 9 of
HyperTalk 2.2: The Book."
That's not a grammar, but apparently --- and testing with the
reference implementation shows this --- answer "hello" with 2+2
is an error.
Assuming that you want that the "or" of
answer ... with x_1 or ... or x_n
be treated as a ",", and when using parenthesizes around an
expression, it
should be treated as an "||", I suggest the grammar would
something like
I've tried that, I got a reduce/reduce conflict. Hopefully,
knowing that any operator except parenthesis being in the or
list is a parse error will help.
Otherwise, I think this is a sign of poor language design. If you later
want to design your own scripting language, then you should avoid the
confusion that will inevitably arise by the "or"'s having different
semantic meaning.
The language wasn't designed with the implementor in mind. I'm
pretty sure it hates being implemented.
Consider some other wonderful expressions:
field "name" gets contents of a field
card "name" refers to card by name
card field "name" gets contents of a field on card layer
card (field "name") refers to card by name
Yep, another beautiful conflict.
- Re: How to change default outcome of shift/reduce conflict?, (continued)
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/13
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?,
Anthony DeRobertis <=
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/16
- Re: How to change default outcome of shift/reduce conflict?, Akim Demaille, 2002/01/17
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/17
- Message not available
- Re: [FC-general] Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15
- Re: [FC-general] Re: How to change default outcome of shift/reduce conflict?, Tim Van Holder, 2002/01/15
- Re: [FC-general] Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15
- Re: How to change default outcome of shift/reduce conflict?, Akim Demaille, 2002/01/13
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/13
- Re: How to change default outcome of shift/reduce conflict?, Akim Demaille, 2002/01/12
Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/15