From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA21717; Fri, 19 Oct 2001 13:28:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA21614 for caml-list@pauillac.inria.fr; Fri, 19 Oct 2001 13:28:05 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA18981 for ; Fri, 19 Oct 2001 10:57:02 +0200 (MET DST) Received: from hugo.int-evry.fr (hugo.int-evry.fr [157.159.100.81]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9J8v1n09285 for ; Fri, 19 Oct 2001 10:57:01 +0200 (MET DST) Received: from (rinderkn@localhost) by hugo.int-evry.fr (8.8.8/jtpda-5.3) id KAA25763 ; Fri, 19 Oct 2001 10:56:43 +0200 (MET DST) Date: Fri, 19 Oct 2001 10:56:43 +0200 From: Christian RINDERKNECHT To: "Rafael 'Dido' Sevilla" Cc: Caml List Subject: Re: [Caml-list] putting stuff in an ocamlyacc-generated mli file Message-ID: <20011019105643.A23712@hugo.int-evry.fr> References: <20011019160426.A11610@team.ph.inter.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <20011019160426.A11610@team.ph.inter.net>; from Rafael 'Dido' Sevilla on Fri, Oct 19, 2001 at 04:04:26PM +0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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