From: Christian RINDERKNECHT <rinderkn@hugo.int-evry.fr>
To: "Rafael 'Dido' Sevilla" <sevillar@team.ph.inter.net>
Cc: Caml List <caml-list@pauillac.inria.fr>
Subject: Re: [Caml-list] putting stuff in an ocamlyacc-generated mli file
Date: Fri, 19 Oct 2001 10:56:43 +0200 [thread overview]
Message-ID: <20011019105643.A23712@hugo.int-evry.fr> (raw)
In-Reply-To: <20011019160426.A11610@team.ph.inter.net>; from Rafael 'Dido' Sevilla on Fri, Oct 19, 2001 at 04:04:26PM +0800
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
next prev parent reply other threads:[~2001-10-19 11:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-19 8:04 Rafael 'Dido' Sevilla
2001-10-19 8:56 ` Christian RINDERKNECHT [this message]
2001-10-19 9:10 ` Markus Mottl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011019105643.A23712@hugo.int-evry.fr \
--to=rinderkn@hugo.int-evry.fr \
--cc=caml-list@pauillac.inria.fr \
--cc=sevillar@team.ph.inter.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox