2009/4/4 john skaller <skal...@users.sourceforge.net>

>
> On 04/04/2009, at 7:08 AM, Emmanuel Onzon wrote:
>
>  and cal_priority must become:
>>
>> let cal_priority p =
>>  match p with
>>  | `No_prio -> No_priority
>>  | `Eq_prio p -> Eq_priority p
>>  | `Less_prio p -> Less_priority p
>>  | `Lesseq_prio p -> Lesseq_priority p
>>  | `Greater_prio p -> Greater_priority p
>>  | `Greatereq_prio p -> Greatereq_priority p
>>
>> Instead of:
>>
>> let cal_priority priority_data p =
>>  let cp p =
>>    try find_priority priority_data p
>>    with Not_found -> failwith ("Priority " ^ p ^ " not defined!")
>>  in
>>  match p with
>>  | `No_prio -> No_priority
>>  | `Eq_prio p -> Eq_priority (cp p)
>>  | `Less_prio p -> Less_priority (cp p)
>>  | `Lesseq_prio p -> Lesseq_priority (cp p)
>>  | `Greater_prio p -> Greater_priority (cp p)
>>  | `Greatereq_prio p -> Greatereq_priority (cp p)
>>
>> Off course it is probably better to code with the regular variants
>> directly instead of the polymorphic ones and get rid of cal_priority.
>>
>
> I think there is a reason to decouple the value used by Felix and that used
> by Dypgen:
> it keeps the typing decoupled. That my be important, remember Felix may
> *store*
> grammar productions (including any priority relations) on disk and reload
> them.
>
>
>
>> Remark the empty list at the end of the 4-tuple that makes the rule. It is
>> a list of options for the rule (it is only useful when the lexer generator
>> is dypgen see 6.1 of the manual for more info).
>>
>> In addition to the new rule and the new action, define_scheme and
>> extend_grammar should return the list of string couples (nt,cons) where nt
>> is a new non terminal bind to the constructor cons, to allow the user action
>> to return the appropriate command Bind_to_cons.
>>
>>
>
> What happens if the string is not new? add_nt just ignored it so it was
> always safe..
>

>From the manual p.41:
If the non terminal which string is nt is already bound to a constructor
then there are two possible
outcomes:
    • The string cons is the same as the one that this non terminal is
already bound to, then
       nothing is changed.
    • The string cons is different from the one that this non terminal is
already bound to, then
       the parser raises:
       exception Constructor_mismatch of (string * string)
       where the first string is the one representing the constructor that
the non terminal was pre-
       viously bound to and the second string is cons.
------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to