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 QAA31789; Tue, 22 Apr 2003 16:28:07 +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 QAA32043 for ; Tue, 22 Apr 2003 16:28:06 +0200 (MET DST) Received: from isis.lip6.fr (isis.lip6.fr [132.227.60.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h3MES4n29748 for ; Tue, 22 Apr 2003 16:28:04 +0200 (MET DST) Received: from spi.lip6.fr (IDENT:root@spi.lip6.fr [132.227.83.55]) by isis.lip6.fr (8.12.9/jtpda-5.4+victor) with ESMTP id h3MES4qp002456 for ; Tue, 22 Apr 2003 16:28:04 +0200 X-pt: isis.lip6.fr Received: from inria.fr ([132.227.83.193]) by spi.lip6.fr (8.8.7/jtpda-5.2) with ESMTP id QAA04493 for ; Tue, 22 Apr 2003 16:28:03 +0200 Date: Tue, 22 Apr 2003 16:28:57 +0200 Subject: Re: [Caml-list] ocamlyacc bug? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) From: Damien Doligez To: "Caml-List" Content-Transfer-Encoding: 7bit In-Reply-To: <002101c30895$52410cd0$fe00a8c0@hama> Message-Id: X-Mailer: Apple Mail (2.551) X-Scanned-By: isis.lip6.fr X-Spam: no; 0.00; damien:01 caml-list:01 bug:01 misfeature:01 foo:01 tokens:01 token:01 doligez:01 declaring:01 parser:02 module:03 circular:03 wrote:03 soohyoung:03 lexbuf:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tuesday, April 22, 2003, at 08:06 AM, SooHyoung Oh wrote: > Is the following an ocamlyacc bug? No. At worst, it is a misfeature that results in an unclear error message. > When making application with using ocamlyacc + ocamllex, > you can make main function in trailer part (after second "%%") of > "foo.mly" > It that case, it generates an error like this: > This expression has type Lexing.lexbuf -> Eg_parse.token > but is here used with type Lexing.lexbuf -> token The problem in your source, is that you add your main function at the end of the parser. But this function uses the lexer, so you make Eg_parse depend on Eg_lex. But the design of ocamllex/ocamlyacc is that the parser is declaring the type of tokens, and the lexer opens the parser module to use this declaration, so it is Eg_lex that depends on Eg_parse. By adding your main function at the end of eg_parse.ml, you make a circular dependency between eg_parse and eg_lex. You should add your main function at the end of eg_lex instead. -- Damien ------------------- 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