Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 884417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:44:49+00:00 2026-05-15T12:44:49+00:00

maybe I’m just failing in a really simple thing but I’m developing an intepreter

  • 0

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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:44:50+00:00Added an answer on May 15, 2026 at 12:44 pm

    You need to create an impossible.mli and compile that. That will produce the impossible.cmi and only the .cmi.

    Alternatively:

    ocamlc -i impossible.ml
    

    will print the mli to stdout. You could do something like this:

    ocamlc -i impossible.ml > impossible.mli
    ocamlc -c impossible.mli
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe this is a very simple question, but I just can not figure out.
Maybe my title is not the best but here is what I really want.I
Maybe this question will look simple but I'm trying to look at some member
Maybe I'm afflicted with myopia and just can't see what's wrong anymore but I
Maybe this is very basic, but I am all confused. I have a simple
Maybe this is something I am just missing, but is there any way to
Maybe I just haven't done a LEFT JOIN in too long, but I'm perplexed.
Maybe this question is silly but I really don't know how to solve. First,
Maybe my question is simple to solve for you, but I'm sitting here for
Maybe this is a simple question, but I didn't find answer in web. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.