From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p69BqjA6016526 for ; Sat, 9 Jul 2011 13:52:45 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsCAM8/GE5V2gB4hWdsb2JhbABTmF+PBgEBAQoLCwUWJYh8o2+eSg6GLASjHQ X-IronPort-AV: E=Sophos;i="4.65,503,1304287200"; d="scan'208";a="112860752" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail1-smtp-roc.national.inria.fr with SMTP; 09 Jul 2011 13:52:39 +0200 X-Alinto-smtpauth-localdomain: Yes Received: from seldon (unknown [85.218.93.111]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id C4BE1E6430A; Sat, 9 Jul 2011 13:52:35 +0200 (CEST) Received: from yziquel by seldon with local (Exim 4.72) (envelope-from ) id 1QfVkO-0007ol-Tu; Sat, 09 Jul 2011 13:30:56 +0200 Date: Sat, 9 Jul 2011 13:30:56 +0200 From: Guillaume Yziquel To: caml-list@inria.fr Message-ID: <20110709113056.GQ3763@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: [Caml-list] Incremental type inference Hi. I'm currently writing a small functional language, and I've got a rather general question about implementing type checking or type inference in an incremental fashion. I'm currently using dypgen for generating the parser, one important reason being the ability to abort a reduction by raising the Dyp.Giveup exception. For various reasons, I want to be able to do some type checking or type inference during the parse phase in order to abort the reduction of a parsing rule if typing gets inconsistent. My problem is therefore to have a maintainable way to implement a type inference algorithm that operates on incomplete type information (as useful information for type inference may be located in a yet unparsed portion of the code to be compiled). I'm currently using Mercury to do that, and it sorts of works, but I've got the feeling that I'm slowly heading to a maintenance nightmare. I'm therefore wondering if anyone has tried to implement such a thing before, and if not, if people with some experience in the implementation of type inference algos have some advice on that matter. Such as the choice of datastructures or specific caveats specific to such an incremental algorithm. Best regards, -- Guillaume Yziquel