I want to build a lexer with ocamllex before the construction of a parser with menhir.
I have wrote the .mll file. The following command gave me this message:
> ocamllex lexer.mll
71 states, 2138 transitions, table size 8978 bytes
Then I typed the following one:
> ocamlc -c lexer.ml
File "lexer.mll", line 48, characters 12-17:
Error: Unbound constructor COMMA
The excerpt of the .ml file :
...
(* Lexing Rules *)
rule tokens = parse
| ',' { COMMA }
| ';' { SEMICOLON }
| '(' { LPAREN }
| ')' { RPAREN }
| '[' { LBRACKETS }
| ']' { RBRACKETS }
| '{' { LBRACE }
| '}' { RBRACE }
...
What I understand is that those actions are not mapped to anything, hence the unbound error.
Finally, what I want to know is how I do these mappings without writing the parser or the .mly file? I'm pretty new to the language and what I want to achieve is a simple lexer built with the ocamllex.