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

>
> On 04/04/2009, at 7:08 AM, Emmanuel Onzon wrote:
>
>
>> Non terminals too became strings:
>>
>>      | NONTERMINAL (sr,s,p) ->
>>          let nt = mapnt s in
>>          let nt =
>>            try dyp.add_nt nt "Obj_sexpr"
>>            with Dyp.Constructor_mismatch _ -> failwith ("CONSTRUCTOR
>> MISMATCH " ^ s)
>>            | Dyp.Bad_constructor _ -> failwith ("BAD CONSTRUCTOR FOR " ^
>> s)
>>          in
>>          let ntpri = cal_priority priority_data p in
>>          Dyp.Non_ter (nt,ntpri)
>>
>> becomes:
>>
>>      | NONTERMINAL (sr,s,p) ->
>>          let nt = mapnt s in
>>          let ntpri = cal_priority p in
>>          Dyp.Non_ter (nt,ntpri)
>>
>>
>> Watch out that in the new code:
>>
>>      | NONTERMINAL (sr,s,p) ->
>>          let nt = mapnt s in
>>          let ntpri = cal_priority p in
>>          Dyp.Non_ter (nt,ntpri)
>>
>> The binding of nt to "Obj_sexpr" has disappeared (because it is not done
>> with add_nt anymore). You must not forget to bind this nt to "Obj_sexpr"
>> with Bind_to_cons if nt is new. This must be done when the calling user
>> action returns its parser command list.
>>
>
>  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.
>>
>
> Erick missed that, but I fixed it .. it is VERY UGLY because basically
> EVERY production has to
> return every non-terminal in its RHS in a Bind_to_const list. So each
> non-terminal is bound
> on EVERY occurrence. DSSL structure could fix that by requiring all global
> non-terminals
> be defined, but it is still a pain because if you import another DSSL into
> this one,
> you have to bind every non-terminal in it (in case of recursion we can have
> forward
> references).
>

If you have a better interface in mind I'm open to suggestions.
I think I could add an option that would allow to define
a default constructor. Each time a new non terminal is not
bound to a constructor, it would be bound to the default one.
Would that solve the problem of ugliness ?
------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to