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 VAA30841; Tue, 13 Nov 2001 21:37:19 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA30989 for ; Tue, 13 Nov 2001 21:37:18 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fADKb5j26544; Tue, 13 Nov 2001 21:37:05 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA30804; Tue, 13 Nov 2001 21:36:57 +0100 (MET) Date: Tue, 13 Nov 2001 21:36:57 +0100 From: Xavier Leroy To: "Marcin 'Qrczak' Kowalczyk" Cc: caml-list@inria.fr Subject: Re: [Caml-list] A few questions regarding the compiler Message-ID: <20011113213657.B24821@pauillac.inria.fr> References: <9smdf7$511$1@qrnik.zagroda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from qrczak@knm.org.pl on Sun, Nov 11, 2001 at 09:54:25PM +0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > In 3.03 alpha and in the forthcoming 3.03, additional "hooks" were > > added to the toplevel so that it can call user-provided functions for > > displaying evaluation results, including uncaught exceptions. The > > Camlp4 preprocessor makes good use of this new feature. > > Only toplevel? I would like to have it in standalone executables. For standalone executables, it is very easy to wrap your generated program in a catch-all "try...with" construct, and print the escaping exception as you see fit. > I don't see how Camlp4 could help. The compiler is not written in > OCaml, it only generates OCaml output. Camlp4 (among other features) provides an easy way to construct OCaml abstract syntax trees and have then compiled or executed by the OCaml compilers or toplevel. It exploits a number of hooks in the compilers and toplevel to achieve fairly tight integration with them. So, I'm pretty sure it could help, provided your compiler is written in OCaml indeed. > [toplevel interface not doing what you want] > I don't want to have to compile a custom OCaml version - it should > work with whatever is installed with OCaml. Methinks you're asking for too much here :-) > Another question. Low-level libraries for my language contain many > embedded OCaml snippets written by hand, so they often contain errors. > Is it possible to tell the OCaml compiler about original source > positions for parts of the program, so it reports them in error > messages? I mean like '# line_no "filename"' in cpp. Maybe Camlp4 > could help? The ocamlc and ocamlopt compilers honor '# lineno "filename"' directives. > Yet another question. OCaml doesn't accept an identifier as the > rhs of let rec (an identifier defined earlier). Why? I had to make > a little workaround to not generate such bindings. I guess it's the > only difference between "what is accepted in let rec" and "what allows > generalization of free type variables"? IIRC, the reason was that this offered no increase in expressive power, yet would require a nasty special case in the compilation scheme for "let rec" definitions. - Xavier Leroy ------------------- 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