Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>OCaml DebuggerNew to Visual Studio Code? Get it now.

OCaml Debugger

hackwaly

|
6,136 installs
| (0) | Free
OCaml debugger.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

OCaml Debugger

Please report issuses here

Prerequisite

opam install earlybird

Sample launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "OCaml Debug",
      "type": "ocaml-debugger",
      "request": "launch",
      "program": "${workspaceFolder}/a.out"
    }
  ]
}

Assuming a file at src/main.ml

let fizzbuzz i = match ((i mod 3), (i mod 5)) with
    | (0, 0) -> "fizbuzz"
    | (_, 0) -> "buzz"
    | (0, _) -> "fizz"
    | (_, _) -> string_of_int i;;

let do_fizzbuzz n = for i = 1 to n do
    print_endline (fizzbuzz i)
done;;

do_fizzbuzz 100;;

Compile main.ml

ocamlc -g src/main.ml
# creates a.out in root of the project

Then set breakpoint in main.ml and run "OCaml Debug" from the VS Code Debug panel.

FAQ

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2019 Microsoft