Anthony DeRobertis wrote:
>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."

I plugged in this grammar into Bison, which is un-ambiguous:

%token ANSWER, WITH, STUFF
%token LP "("
%token RP ")"
%left OR

%%

answer:
   ANSWER expression
 | ANSWER expression WITH factor_list

factor_list:
    factor
  | factor_list OR factor

expression:
    factor
  | expression OR expression

factor:
    STUFF
  | "(" expression ")"

%%

(And you can exclude the rule answer -> ANSWER expression.)

Does that not capture what you want?

>This language is very weakly typed. So I don't know at parse
>time the type of a variable, or for that matter that it is a
>variable... could just be an unquoted string.

You would have to semantics on the expressions in order to be able to check
whether it is a list or something else, just as an implementation technique.

>I believe HyperCard --- the reference implementation --- uses a
>hand-written recursive descent parser. Or at least I've heard
>rumors to the effect. So I get to hold out some hope.

It is probably LL(1) then (modulo tweaks), which => LALR(1), which Bison
implements. So you should be able to get it into Bison.

  Hans Aberg



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

Reply via email to