Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.
aryx edited this page Sep 27, 2010 · 129 revisions

pfff, is mainly an OCaml API to write static analysis, dynamic analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code. For now the effort is focused on PHP but there is preliminary support for Javascript, Sql, C++, Java, and even TeX. There is also preliminary support for OCaml code so that the infrastructure can be used on the code of pfff itself.

pfff is also made of few tools:

  • pfff, which allows to test the different parsers on a single file
  • pfff_db_light, which does some global analysis on a set of source files and store the data in a marshalled form in a file somewhere (e.g. /tmp/light_db.db)
  • pfff_db, which does language specific global analysis on a set of source files and store the data in a database somewhere (e.g. /tmp/pfff_db)
  • pfff_visual, which is a gtk and cairo based source code visualizer/navigator/searcher leveraging the information computed previously by pfff_db_light and pfff_db
  • sgrep, a syntactical grep
  • spatch, a syntactical patch
  • scheck, a bug finder
  • pfff_tags, an Emacs tag generator

TODO Pfff manual

  • work in progress: OCaml

See Examples.

part1: http://www.youtube.com/watch?v=HRZjBGD3osw

part2: http://www.youtube.com/watch?v=993pmNLY_VU

OCaml may seem to be a weird choice. It's not a very popular language. But actually in the static analysis world, it is one of the most popular langage. Researchers in Berkeley and Stanford are using OCaml for performing analysis of C code (e.g. Necula with CIL at Berkeley, Aiken with Saturn at Stanford), some type inferers for Ruby are written in OCaml (DRuby), the Windows Device verifiers (based on work from Microsoft Research by Thomas Ball on SLAM) is written in OCaml, people in the Linux kernel are using the Coccinelle tool to perform some complex refactoring and to find bugs, also written in OCaml. In fact one of the latest programming language of Microsoft, F#, is directly inspired (one could say copy) from OCaml.

OCaml is good for code analysis. Trust me.

Clone this wiki locally