The problem is that no StringMap
module exists: you have to generate one with a functor application such as module StringMap = Map.Make (String)
. Place this in the header, not the trailer. (The trailer code will be placed at the end of the generated file, and thus bindings established in it cannot be seen from within your lexer code.)
If you like you may also open the module:
open module StringMap = Map.Make (String)
Opening modules is considered somewhat poor style, though. In particular avoid opening modules such as applications of Map
and Set
, as their definitions of compare
will shadow the usual one from Pervasives
and generate confusion.