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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:25:48+00:00 2026-05-23T05:25:48+00:00

I am writing a compiler in Ocaml. The tracback works well when I compile

  • 0

I am writing a compiler in Ocaml. The tracback works well when I compile and test it with make in a terminal, for instance:

export OCAMLRUNPARAM=b
./Simpler-Basic test.sib
Fatal error: exception Match_failure("interp.ml", 45, 21)
Called from file "interp.ml", line 97, characters 72-86
Called from file "list.ml", line 74, characters 24-34
Called from file "interp.ml", line 108, characters 9-35
Called from file "main.ml", line 54, characters 4-17
make: *** [all] Error 2

But when I compile and test it in my Emacs by Meta-x compile followed by make, it does not show the traceback part in the buffer:

make
export OCAMLRUNPARAM=b
./Simpler-Basic test.sib
Fatal error: exception Match_failure("interp.ml", 45, 21)
make: *** [all] Error 2

Compilation exited abnormally with code 2 at Sat Jun 18 19:03:04

There is a part in my .emacs to do traceback that I copied from a friend: http://paste.ubuntu.com/628838/

Could anyone tell me how to amend my .emacs so that it shows traceback as in a terminal? Thank you very much

  • 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-23T05:25:49+00:00Added an answer on May 23, 2026 at 5:25 am

    Where did you write export OCAMLRUNPARAM=b?

    If you wrote this in a makefile (↹ stands for a tab):

    ↹export OCAMLRUNPARAM=b
    ↹./Simpler-Basic test.sib
    

    then it doesn’t work because each makefile command is executed in a separate shell, so the environment variable assignment vanishes after the first line completes. You can combine the two lines in a single logical line instead:

    ↹export OCAMLRUNPARAM=b; \
    ↹./Simpler-Basic test.sib
    

    If you always want backtraces when running an Ocaml program from within Emacs, set the environment variable in your .emacs:

    (setenv "OCAMLRUNPARAM" "b")
    

    In order for Emacs to recognize the backtrace messages as error messages with a location, you need to register them in compilation-regexp-alist. Put something like this in your .emacs (untested):

    (eval-after-load "caml"
      (add-to-list 'compilation-regexp-alist
                   '("\\(^Raised at\\|Called from\\) file \"\\([^"\n]+\\)\", line \\([0-9]+\\)"
                     2 3)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a compiler in ocaml, using ocamllex/yacc. Things are going well, but I've
I'm writing a sparc compiler. One of my test cases works fine when run
I am experimenting with writing a toy compiler in ocaml. Currently, I am trying
I'm writing a compiler to compile a subset of Java to Java bytecode using
I am writing a compiler written in OCaml. Sometimes when there is an error
I'm writing a compiler which uses C as an intermediate code which is (Currently)
I'm writing a compiler in C and need to get the ASCII value of
I am writing a compiler in Python using Eclipse with PyDev. I've come to
I'm writing a compiler in Python, and I made a hand-written lexer, because I
I'm writing a JIT compiler with an x86 backend and learning x86 assembler and

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.