caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] camlp4: LIST1 construct on record patterns
@ 2002-01-13  5:38 Jeff Henrikson
  2002-01-13 13:48 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Henrikson @ 2002-01-13  5:38 UTC (permalink / raw)
  To: caml-list

In camlp4, I don't seem to be able to break apart a record pattern in any way.  I must not understand how to use LIST1 properly:



let try_extend _ =
  let cons = "Bogus" in
  let test_label_eq = Grammar.Entry.find expr "test_label_eq" in
  let lbl_expr_list = Grammar.Entry.find expr "lbl_expr_list" in
  EXTEND
    expr: LEVEL "simple"
    [ [ $cons$; "{"; memb = LIST1 lbl_expr_list SEP ";" ; "}" ->
          <:expr<{$list:memb$}>> ] ]
    ;
  END;;

try_extend "junk";;

...
      [ [ $cons$; "{"; memb = LIST1 reenter SEP ";" ; "}" ->
            <:expr<{$list:memb$}>> ] ]
                          ^^^^
      ;
    END;;
This expression has type Obj.t list but is here used with type
  (MLast.patt * MLast.expr) list


Isn't an Obj.t a completely opaque meaningless entity?

Substituting test_label_eq for lbl_expr_list makes no difference.  I got those identifiers by running:

Grammar.Entry.print expr;;

which doesn't tell me the meaning of test_label_eq, and

Grammar.Entry.print (Grammar.Entry.find expr "test_label_eq");;

doesn't tell me anything either.  Do I just have to go read the source code to know their meaning?  I would have except I guess it
doesn't come default now that camlp4 is part of ocaml.


Jeff Henrikson




-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-01-14  5:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-13  5:38 [Caml-list] camlp4: LIST1 construct on record patterns Jeff Henrikson
2002-01-13 13:48 ` Daniel de Rauglaudre
2002-01-14  2:17   ` Jeff Henrikson
2002-01-14  2:49     ` Jeff Henrikson
2002-01-14  5:10       ` Daniel de Rauglaudre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).