[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ocaml-3.07 patch (camlp4 && optional arguments bug)



> Attached a "human" version of the patch that can be applied with "patch
> -p0" as usual to the root ocaml source directory. I'm rebuilding right
> now ocaml with that patch to see if it works ...

 Hhmmmm. There are at least three changes in this patch:

 1) the bug fix (OK)
 2) error messages improvement (OK)
 3) other changes that introduce two new productions
    a_LABEL and a_OPTLABEL. I suspect these productions to be meant
    to replace a_TILDEINDENT end a_QUESTIONINDENT. Nevertheless,
    the replacement seems incomplete and the two codes coexist.
    Let's hope that the patch doesn't introduce yet another error ;-)
    (I do not understand the code enough to understand whether this
    could be the case. I am probably just plainly wrong and the two
    new productions are necessary.).

 						A bit too paranoid,
						        C.S.C.

P.S: these are the portions of the code that introduce the two new
     grammar productions.

> +value a_LABEL = Grammar.Entry.create gram "a_LABEL";
> +value a_OPTLABEL = Grammar.Entry.create gram "a_OPTLABEL";

> +      | i = a_LABEL; t = SELF -> Qast.Node "TyLab" [Qast.Loc; i; t]
>        | i = a_QUESTIONIDENT; ":"; t = SELF ->
> +          Qast.Node "TyOlb" [Qast.Loc; i; t]
> +      | i = a_OPTLABEL; t = SELF ->
>            Qast.Node "TyOlb" [Qast.Loc; i; t] ] ]

> +      | i = a_LABEL; p = SELF ->
> +          Qast.Node "PaLab" [Qast.Loc; i; Qast.Option (Some p)]
>        | i = a_TILDEIDENT -> Qast.Node "PaLab" [Qast.Loc; i; Qast.Option None]
> ...
> +  ;
> +  a_OPTLABEL:
> +    [ [ s = OPTLABEL -> Qast.Str s ] ]
>...
> +         (Grammar.Entry.obj (a_OPTLABEL : 'a_OPTLABEL Grammar.Entry.e));
> +       Gramext.Stoken ("", "(");
> +       Gramext.Snterm
> +         (Grammar.Entry.obj (patt_tcon : 'patt_tcon Grammar.Entry.e));
> +       Gramext.srules
> +         [[Gramext.Sopt
> +             (Gramext.Snterm
> +                (Grammar.Entry.obj (eq_expr : 'eq_expr Grammar.Entry.e)))],
> +          Gramext.action
> +            (fun (a : 'eq_expr option) (loc : int * int) ->
> +               (Qast.Option a : 'a_opt));
> +          [Gramext.Snterm
> +             (Grammar.Entry.obj (a_opt : 'a_opt Grammar.Entry.e))],
> +          Gramext.action
> +            (fun (a : 'a_opt) (loc : int * int) -> (a : 'a_opt))];
> +       Gramext.Stoken ("", ")")],
> +      Gramext.action
> +        (fun _ (eo : 'a_opt) (p : 'patt_tcon) _ (i : 'a_OPTLABEL)
> +           (loc : int * int) ->
> +           (Qast.Node
> +              ("PaOlb",
> +               [Qast.Loc; i; Qast.Option (Some (Qast.Tuple [p; eo]))]) :
> +            'patt));
> +      [Gramext.Snterm
> ...

-- 
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://www.cs.unibo.it/~sacerdot
----------------------------------------------------------------



Reply to: