Hello, maybe I'm just failing in a really simple thing but I'm developing an intepreter written in OCaml with standard tools as ocamllex and ocamlyacc and I have this situation:
- iparser.mly contains parser spec
- ilexer.mll contains lexer spec
- impossible.ml contains the vm that executes the code and all the types needed
The instruction type that defines various instructions is in impossible.ml
and it is needed by the parser but impossible.ml
uses the parser defined in iparser.mly
so they both need each other to compile correctly.
Is there a way to produce just the .cmi
file for my impossible.ml
? In this way the parser would know about types defined in impossible.ml
and it will allow me to compile impossible.cmo/.cmi
and later compile also impossible.cmo
. Then I can link all of them together.
So far my compiling script is:
ocamlyacc iparser.mly
ocamlc -c iparser.mli
ocamllex ilexer.mll
ocamlc -c ilexer.ml
ocamlc -c iparser.ml
ocamlc -c impossible.ml
ocamlc -o imp.exe ilexer.cmo iparser.cmo impossible.cmo
but this doesn't work because ocamlc -c iparser.ml
needs at least impossible.cmi
to know the types.
Any suggestions? Thanks in advance..