I am doing an OCaml assignment, and was just snooping through the assignment files, where I found what I think to be a generated file. It has a lot of code like this,
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 81 "lexer.mll"
( TOK_EOF )
# 239 "lexer.ml"
| 1 ->
# 82 "lexer.mll"
( new_line lexbuf; TOK_WHITE )
# 244 "lexer.ml"
I'm sorry about the spacing, but that is how it appears in the file. Since I really don't know if the #
characters are supposed to be to the left like that, I'm just pasting it exactly as it appears.
What is the meaning of the lines of the form # <number> <string>
?
You're right, this is a generated file. Namely it was generated from a file called lexer.mll
(which is an ocamllex file).
The lines starting with #
associate code in the generated file with lines in the original file. So for example # 82 "lexer.mll"
means: "The following code was generated from line 82 of lexer.mll". The ocaml compiler uses the information for error messages. So if the .ml contains an error (which would happen because the programmer wrote incorrect code in the .mll file), the error message will point to a line in the .mll file, not the generated .ml file.