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 NAA06810; Mon, 15 Sep 2003 13:15:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 NAA08381 for ; Mon, 15 Sep 2003 13:15:18 +0200 (MET DST) Received: from ep09.kernel.pl (ep09.kernel.pl [212.87.11.162]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8FBFFT26976 for ; Mon, 15 Sep 2003 13:15:15 +0200 (MET DST) Received: (qmail 9033 invoked by uid 566); 15 Sep 2003 11:15:05 -0000 Date: Mon, 15 Sep 2003 13:14:58 +0200 From: Michal Moskal To: "Rafael 'Dido' Sevilla" Cc: caml-list@inria.fr Subject: Re: [Caml-list] line number information in abstract syntax trees Message-ID: <20030915111458.GA26769@roke.freak> Mail-Followup-To: Rafael 'Dido' Sevilla , caml-list@inria.fr References: <20030915075339.GA20719@imperium.ph> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030915075339.GA20719@imperium.ph> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 rafael:01 'dido':01 int':01 decl:01 decl:01 foo:01 michal:01 moskal:01 malekith:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Sep 15, 2003 at 03:53:39PM +0800, Rafael 'Dido' Sevilla wrote: > Note that all the record types have additional fields that look like > 'plineno:int' and every variant type has an int tacked on somewhere. > That int is supposed to contain the line number. > > This works just fine, but it just seems to me like such a grossly ugly > hack into what is otherwise an elegant-looking data structure. Anyone > have style guidelines type location = { l_line : int; l_file : string; } type decl = { decl_location : location; decl_raw : raw_decl; } and raw_decl = | Foo | Bar of decl list ... This is the way used in OCaml compiler itself and few my compilers. -- : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners