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.


_______________________________________________
Freecard-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freecard-general

Reply via email to