Is it possible the get the AST for an OCaml program?

I'd like to be able to get the AST for a given OCaml program (I'd like to walk the AST and generate an instrumented version of the code or do some kind of transformation, for example). Do any of...

not able to install anything using opam

I installed opam with homebrew on Mac OS X 10.10. But I can't install anything using opam. This is an example error output that get when I try to install ocamlfind: # opam-version 1.2.0 # os ...

How do I install the OCaml Core library on (Arch) Linux x86_64?

$ ocaml -version The OCaml toplevel, version 4.02.1 $ opam --version 1.2.0 $ opam init $ opam install core #=== ERROR while installing camlp4.4.02.1+system ==============================# #...

What's the purpose of _tags file with OCaml, and how to interpret the contents?

From https://stackoverflow.com/questions/28751359/building-ocaml-code-that-uses-list-comprehension post, I can use _tags file to execute ocamlbuild with less build options. $ cat _tags <**/*> :...

Trying (and failing) to build OCaml package "Javalib"

I'm trying to build the OCaml package Javalib through opam. I can't get it to build, here is the ouput: The following actions will be performed: ∗ install javalib 2.3.1 =-=- Gathering...

Unbound module Camlp4

I am aware of similar questions on this site but none of them have helped to solve my problem. I am very new at OCaml and am using the following tutorial about using Camlp4...

Unbound module Core

Under OS X, OCaml works fine, but under Linux (Ubuntu 14.04 LTS), it returns the following error: zsh-5.0% ocaml OCaml version 4.02.1 Findlib has been successfully loaded. Additional...

ocaml batteries unbound toploop error

I am trying to install bap required for ropc https://github.com/pakt/ropc as per the instructions given in ropc/bap/INSTALL in Ubuntu 14.04 . I have run these commands successfully . sudo apt-get...

Are ocamlfind package predicates implemented?

I have a package named sundialsml, in which I want to load a slightly different .cm(x)a file depending on whether a subpackage named no_sens is loaded. Promisingly enough, the findlib 1.6.2...

How to compile using Camlp4?

I am testing out quotations in Camlp4. My tester.ml program is as follows: open Camlp4.PreCast;; let x = <:Cstm< x = 1 + 2 >>;; let y = <:expr< let y = 1 + 2 >>;; print_string "done";; I have...

comparing F# and OCaml

I know roughly how F# and OCaml differ in terms of "features" (e.g. functors, camlp4, units of measure...). I wonder about the following: Concerning code that doesn't contain said features, is...

"Unbound module quotation" error, even after loading camlp4o.cma

I'm new to OCaml, and I'm trying to follow 4.3 of this tutorial for defining custom quotation behavior. From what I've read, it seems that loading camlp4o.cma is what makes the Quotation module...

LLVM tutorial OCaml Compilation Error

I have been working through the LLVM Kaleidoscope Tutorial for OCaml. On the second part of the tutorial, I have navigated to the example code in the folder OCaml-Kaleidoscope\Chapter2 I am...

Make compatible ocaml, camlp4, ppx, node, js_of_ocaml, ocamlbuild

After installing npm and node, compiling OCaml files with js_of_ocaml gave errors, thus I did opam switch reinstall system: :testweb $ opam switch reinstall system Your system compiler has been...

Writing a parser for a DSL in OCaml using ppx and extension point

Recently, it was announced in OCaml official github that Camlp4 is replaced by ppx rewriters and extension points (https://github.com/ocaml/camlp4): Camlp4 was part of the official OCaml...

OCaml open only certain values/types from module

Does OCaml have an equivalent (possibly involving a camlp4 directive) of from module import value1, value2 in Python or use Module qw[value1 value2]; in Perl ? I'd like to be able to write...

How to install Eliom

I can't install eliom of the Ocsigen project $ opam install eliom Your request can't be satisfied: - No package matches eliom. $ opam install eliom.5.0.0 Your request can't be satisfied: - No...

Opam failures on macOS Sierra

I'm having problems very similar to this question. I have a MacBook Pro on macOS Sierra. I've installed ocaml and opam via brew. (brew install ocaml, brew install opam) This installed ocaml...

How do I use camlp4 in an OCaml program to parse another OCaml program into an AST?

I'm currently trying to translate OCaml programs (with a fairly standard/limited grammar) into Racket, and I'm trying to see if there is a way to do the parsing to intermediate representation...

Does Unix Cache Binaries?

This is a question for my understanding, I believe that *nix systems rarely required reboot. i.e. if you installed a new "application" or even kernal 9/10 no reboot is required. I recently...

opam install cohttp fails because of camlp4

I'm tyring to install cohttp with opam and I get an error regarding modular-implicits Here is the stack trace for camlp4 [email protected]:~$ opam install camlp4 The following...

Lexer/filter for comments

Is there an OCaml tool that allows filtering comments in source files, similar to gcc -E? Ideally, I'm looking for something that will remove everything but comments, but the other way around...

Trying to install utop for OCaml in Fedora 26; got an error about installing LWT

I currently have Fedora 26 installed, and I have installed the following packages: sudo dnf install opam ocaml gcc gcc-c++ m4 make ocamldoc sqlite-devel libcurl-devel fuse-devel zlib-devel...

utop no longer supporting camlp4?

I wanted to use a package which has some camlp4 extensions in utop, but I get: utop # #camlp4o;; utop was built without camlp4 support. This is with utop version 2.0.1 and OCaml 4.05.0. I...

ocaml command line cannot find “topfind”

I've installed opam, run opam init, run opam switch 4.06.0 which created a 4.06.0 directory inside ~/.opam, run "eval opam confing env" which exports $OCAML_TOPLEVEL_PATH as...

How to load toplevel modules silently

In my ~/.ocamlinit, I have some directives: #use "topfind" #thread #require "core.top" As a result, every time the OCaml toplevel (i.e. ocaml) starts, I get this huge wall of text: OCaml...

SystemT Compiler and dealing with Infinite Types in Haskell

I'm following this blog post: http://semantic-domain.blogspot.com/2012/12/total-functional-programming-in-partial.html It shows a small OCaml compiler program for System T (a simple total...

OCaml and preprocessor have incompatible versions error when installing tcoq

I was trying to install tcoq and I had the following error: "/Users/pinocchio/.opam/4.05.0/bin/ocamlfind" ocamlc -rectypes -w -3-52-56 -c grammar/compat5.ml OCAMLC -c -pp...

Ocaml compiling list comprehensions

I want to use ocamlopt to compile list comprehensions. I do not want to use any special libraries, since ocaml supports list comprehensions at least at the top (interactive) level. Marko Tunjic...

How to make a value of type which is defined with module in OCaml?

TL;DR - In OCaml, how to call the type looks like type 'elt set = (module BatSet.S with type elt = 'elt) and how to make a value of this type? Currently, I'm reading code in the Tezos protocol[*],...