Hi list, I am trying to write a parser using ocamllex for a language for which the usual character -> token -> ast does not make sense and instead one needs to produce the ast directly from the character level. Even though this is not its intended use case, it actually works quite well! Except that, while I can define higher-order rules, such as rule sp item = parse | ' ' { item lexbuf } I cannot actually use such a rule for 'item's which return different types. As far as I can see this is because the set of all rules is translated into a set of recursively defined functions and using 'sp' with 'items' of different types would require the function corresponding to 'sp' to have some explicit polymorphism annotation. Is there a way to twist ocamllex a little more to make this work ? Or if not, would it make sense to expose a way for the user to provide these annotations herself ? Thanks! - Nicolas