OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of November 12 to 19, 2019.

Table of Contents

Calculon 0.5, an IRC bot library

Simon Cruanes announced

I'm happy to announce that Calculon 0.5 is released. Calculon is a collection of libraries for writing IRC bots with persistent state, plugins, configurable commands, and so on. An instance is ocabot on #ocaml@freenode.

containers 2.7

Simon Cruanes announced

Howdy y'all 🤠, Containers 2.7 has just hit the shelves. The S-expression library is now functorized (so it should be compatible with sexplib with minimal effort); CCDeque has received many improvements; more printers were added; and some efforts towards 3.0 have been initiated (deprecating some of the wartiest warts).

Many thanks to @Fardale, @madroach, and @narimiran!

Caradoc is a parser and validator of PDF files written in OCaml (GPLv2)

Anton Kochkov said

Found recently quite interesting project:

Caradoc is a parser and validator of PDF files written in OCaml. This is version 0.3 (beta).

Caradoc provides many commands to analyze PDFs, as well as an interactive user interface in console.

Caradoc was presented at the the third Workshop on Language-Theoretic Security (LangSec) in May 2016. More information is available on the website of the conference.

See the project here https://github.com/caradoc-org/caradoc

OCamlPro's opam cheat sheet, with a new theme!

Thomas Blanc announced

Earlier, we dusted-off our language and stdlib cheat-sheets. Because we wanted teachers to be able to give those cheats to their students as quickly as possible, we missed a few typos (special thanks to @hannes, @spop, @Khady, @holmdunc and narimiran for their keen eyes).

With more time, we managed to design an opam cheat sheet we are proud of. It is organized in two pages: the first page addresses the everyday average opam use, the second one aims at peculiar advanced use cases (opam-managed project, publishing, repository maintenance, etc.).

Moreover, with the help of listings, we tried the use of colors to enhance the readability. For now we welcome all suggestions and fixes, so as to do a proper release by the end of November. The PR is here.

Note also that there is a lot of space left. The blank space at the end can be used to note your own peculiar commands. In any case do not hesitate to send us your suggestions.

So here is the feedback we'd particularly appreciate:

  • @AltGr and @rjbou, the lead opam developers, designed this cheat sheet so as to shed light on some important functionalities (some I even discovered even though I speak daily with them). If a command you find useful is not in this cheat-sheet, let us know and we'll add it. Feel free to ask for clarification and/or expansion of the manual.
  • Also, any feelings about the brand new LaTeX theme we just crafted? Let us know!

Happy hacking!

Note: If you come to one of our next training session, you'll get a free cheat-sheet! Isn't that a bargain?

Thomas Blanc then added

I was suggested to give a pdf version of the sheet for ease of review: here it is!

BAP 2.0 Release

Ivan Gotovchits announced

The Carnegie Mellon University [Binary Analysis Platform (CMU BAP)][1] is a suite of utilities and libraries that enables analysis of programs in their machine representation. BAP is written in OCaml, relies on dynamically loaded plugins for extensibility, and is widely used for security analysis, program verification, and reverse engineering.

This is a major update that includes lots of new features, libraries, and tools, as well as improvements and bug fixes to the existing code. The following small demo showcases the modern BAP look and feel. In this announcement we would like to focus on two very important features of BAP 2.0:

The Knowledge Base

The Knowledge Representation and Reasoning System, or the Knowledge Base (KB) for short, is the central part of our new architecture. The KB is a step forward from the conventional approach to staging multiple analyses in which dependent analyses (aka passes) are ordered topologically, based on their dependencies. The KB is inspired by logic programming and enables an optimal and seamless staging of mutually dependent analyses. Mutually dependent analyses are also present in the source-based program analysis but are much more evident in the field of binary analysis and reverse engineering, where even such basic artifacts as control flow graph and call graph are not available as ground truth (and in general are not even computable).

Object properties in the KB are represented with directed-complete partially ordered sets. The KB also imposes the monotonicity restriction that requires that all updates to the property are monotonic, i.e., each consequent value of the same property is a refinement of the previous value. These restrictions enable the KB to compute the least fixed point of any property, is computed. A property representation could be optionally refined into a complete lattice, which gives the KB users extra control on how properties are computed.

By storing all information in an external location the KB addresses the scalability issue so relevant to binary analysis and reverse engineering. In the future, we plan to implement a distributed storage for our Knowledge Base as well as experiment with other inference engines. Soon, it should also possible to work with the knowledge base in non-OCaml programs, including our BAP Lisp dialect. That, practically, turns the knowledge base into a common runtime for binary analysis. In the current version of BAP, the Knowledge Base state is fully serializable and portable between different versions of BAP, OCaml, and even between native and bytecode runtimes. The Knowledge Base state could be imported into an application and is integrated with the BAP caching system.

New Program Representation

Employing the tagless final embedding together with our new Knowledge Base we were able to achieve our main goal - to switch to an extensible program representation without compromising any existing code that uses the current, non-extensible, BAP Intermediate Language (BIL). The new representation allows us to add new language features (like floating-point operations or superscalar pipeline manipulations) without breaking (or even recompiling) the existing analyses. The new representation also facilitates creation of new intermediate languages which all can coexist with each other, making it easier to write formally verified analyses.

New pages for OCaml API

sanette announced

in a recent thread: https://discuss.ocaml.org/t/suggestions-for-ocaml-documentation/4504 I (and others) proposed to insert the OCaml manual in the ocaml.org website.

I am now working on the API part of it. Here is a first proposition: https://sanette.github.io/ocaml-api/

Of course it can be improved, and I'm asking for constructive comments, keeping in mind:

On the technical side, finally I didn't use odoc because @octachron remarked that it could lead to issues when generating the PDF. Hence I only post-processed the html; but this is rather light, it takes about 2sec for about 250 files in the libref directory. Once odoc gets updated, we can think back.

Some precise questions:

  • in many pages there is room left on the sidebar, so we could implement a search engine. Would it be useful? Does someone know how to do it?
  • since the API is often next to the programmer's editor, it would be easier to her eyes to adapt the color scheme. Do you favor a javascript button with something like "dark theme/light theme"?


If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.