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 6029525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:53:58+00:00 2026-05-23T04:53:58+00:00

I am writing a compiler written in OCaml. Sometimes when there is an error

  • 0

I am writing a compiler written in OCaml. Sometimes when there is an error of execution, it shows the line of error, but it does not show the context, for instance, how the function is called, with which values…

In order to help debugging, does anyone know a way to show the steps of execution till the error with real value of the relevant variables?

By the way, I am using Emacs as editor.

  • 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-23T04:53:58+00:00Added an answer on May 23, 2026 at 4:53 am

    Ocaml is compiled. You seem to be used to interpreted languages, where the run-time system has access to the full program source code. With a compiled program, the run-time system doesn’t have access to much information. For example, variable names disappear at compile time, and nothing will keep track of the arguments passed to every function except as needed for the normal program execution (doing that would incur a lot of overhead).

    If you compile your program with debugging symbols (pass the -g option to the compiler), you can get a stack trace if your program dies of an uncaught exception. You’ll get function names and some program locations, but not detailed memory contents. Compiling with debugging information results in a bigger executable, but doesn’t change the run-time performance. You need to set the OCAMLRUNPARAM environment variable to contain b when running the program.

    ocamlc -g -o foo foo.ml
    export OCAMLRUNPARAM=b
    ./foo
    

    If you want more information, you need to run your program inside a debugger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've heard of the idea of bootstrapping a language, that is, writing a compiler/interpreter
I was just writing some quick code and noticed this complier error Using the
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
When writing a switch statement, there appears to be two limitations on what you
I have just been re-working an old bit of compiler-like code written using bison.
I came across this: Writing a compiler using Turbo Pascal I am curious if
So lately I have been working on writing a simple compiler to better understand
I'm writing a compiler from (reduced) Pascal into ARM asm. I'm at the second
I'm writing a compiler front end for a project and I'm trying to understand
I have written a compiler and interpreter for a scripting language. The interpreter is

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.