Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocamlyacc bug?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: SooHyoung Oh <shoh@d...>
Subject: [Caml-list] ocamlyacc bug?

Is the following an ocamlyacc bug?

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

It can be fixed by excluding type specification of start non-terminal
function in "foo.ml" like this:
(before)

    let line (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =
       (yyparse yytables 1 lexfun lexbuf : int)

(after)

    let line lexfun (lexbuf : Lexing.lexbuf) =
       (yyparse yytables 1 lexfun lexbuf : int)

If you want, you can view my full source in
http://www.duonix.com/~shoh/ocaml/ocamlyacc.html#bug

---
SooHyoung Oh

-------------------
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