Browse thread
[Caml-list] putting stuff in an ocamlyacc-generated mli file
-
Rafael 'Dido' Sevilla
- Markus Mottl
- Christian RINDERKNECHT
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2001-10-19 (11:28) |
From: | Christian RINDERKNECHT <rinderkn@h...> |
Subject: | Re: [Caml-list] putting stuff in an ocamlyacc-generated mli file |
On Fri, Oct 19, 2001 at 04:04:26PM +0800, Rafael 'Dido' Sevilla wrote: > [I] have this exception defined in my parser.mly: > > exception Undef_sym of string; > > [...] compiler.ml does something like: > > try > let result = Parser.main Lexer.token lexbuf in > ... > with > Parser.Undef_sym x -> Printf.fprintf stderr "Undefined symbol %s" x > > Unfortunately, compiling the compiler with this causes it to choke > saying that Parser.Undef_sym is not found. It's not in the generated > parser.mli file, of course. So apart from editing that (automatically > generated) file manually, how do I get ocamlyacc to put them there? Put your exception in a separate module, say syntax.mli: exception Undef_sym of string Then in parser.mly, you can do: raise (Syntax.Undef_sym "Ooops!") and in compiler.ml: try ... with Syntax.Undef_sym x -> ... Hope this helps. -- Christian ------------------------------------------------------------------------ Christian Rinderknecht Phone +82 42 866 6147 Network Architecture Laboratory Fax +82 42 866 6154 Information and Communications University WWW http://nalab.icu.ac.kr 58-4 Hwaam-dong, Yuseong-gu, Daejeon, e-mail rinderkn@icu.ac.kr 305-732, Korea ------------------- 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