Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.
pad edited this page Feb 12, 2011 · 129 revisions
.. Xcontents::

Welcome to the pfff Wiki!

Introduction

pfff is a set of tools and APIs to perform some 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 also preliminary support for Javascript, C, C++, Erlang, Python, Java, C#, Lisp, Scheme, Haskell, Sql, and even TeX. There is also good support for OCaml and noweb (literate programming) code so that pfff can be used on the code of pfff itself.

Here are the pfff tools:

  • pfff, a small command line program to test the different programming language parsers
  • sgrep, a syntactical grep, to make it easy to find precise code patterns
  • NEW spatch, a syntactical patch, to make it easy to refactor code
  • NEW scheck, a lint-like bugs finder
  • stags, a more precise Emacs tag generator
  • codemap, a gtk and cairo based semantic source code visualizer/navigator/searcher leveraging the information computed by pfff_db. See Examples and Examples2 for screenshots of the tool applied to lots of different open source projects.
  • pfff_db, which does some simple global analysis on a set of source files and store the data in a marshalled form in a file somewhere (e.g. /tmp/PFFF_DB.db)
  • pfff_db_heavy, which does some heavy language specific global analysis on a set of source files and store the data in a database somewhere (e.g. /tmp/pfff_db/)
  • other command line tools leveraging the information computed by pfff_db_heavy such as a deadcode reaper, a test coverage generator, etc.

Install

Click on the "Download Source" button in the top right of this window. If you have git installed on your machine you can also do:

$ git clone git://github.com/facebook/pfff.git

Then follow install.txt which essentiallys tell you to do:

$ ./configure
$ make depend
$ make; make opt
$ make install

Bugs/Feedback

Email to pad at fb dot com or click on "Issues" in the github project bar above.

Documentation

Entry points:

The visualizer

See Codemap and the work in progress: Visualizer manual.

Language specifics analysis and tools

See Matrix.

Libraries

On OCaml development

Internals

Contribute

Look in Internals.

Screenshots

See also Examples and Examples2.

Linux kernel

OCaml Compiler

Pfff itself

Videos

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

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

Related work

pfff is a continuation of the work I've done on coccinelle, an advanced refactoring tool for C http://coccinelle.lip6.fr/ I co-designed with Julia Lawall.

Related research work:

Related old-school Unix tools:

  • ctags
  • cscope
  • lxr

Related tools:

  • Source Insight

In the press

About OCaml

OCaml may seem to be a weird choice. It's not a very popular language. Nevertheless 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