有人可以帮我解释为什么我在这一行有语法错误:let wordMap = StringMap.empty
?这包含在 .mll 文件中。模块 StringMap 在上面定义。
let lexbuf = Lexing.from_channel stdin in
let wordlist =
let rec next l = match token lexbuf with
EOF -> l
| Word(s) -> next (s :: l)
in next []
let wordMap = StringMap.empty in
let wcList = StringMap.fold (fun word count l -> (string_of_int count ^ " " ^ word) :: l) wordMap [] in
List.iter print_endline wcList;;
我知道它什么也没打印,这只是为了测试。