Repository navigation
Main
.. Xcontents::
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, Html, Css, Sql, and even TeX. There is also good support for OCaml and noweb (literate programming) 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 -
spatch, a syntactical patch, to make it easy to refactor code -
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 bypfff_db. See Examples and Examples2 for screenshots of the tool applied to many 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 or JSON form in a file somewhere (e.g./tmp/pfff_db.json) -
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/)
There are also other command line tools leveraging the information
computed by pfff_db_heavy such as a deadcode reaper, a test
coverage generator, etc.
Look in Changes.
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 the instructions in install.txt which
essentially tell you to do:
$ ./configure $ make depend $ make; make opt
Here is a screenshot of Codemap when applied on the early source of the Linux kernel.

part1: http://www.youtube.com/watch?v=HRZjBGD3osw
part2: http://www.youtube.com/watch?v=993pmNLY_VU
- Entry points: Vision, Features, Roadmap, work in progress: Pfff manual
- The visualizer: see Codemap and the work in progress: Visualizer manual
- sgrep/spatch: see Sgrep and Spatch
- scheck: see Scheck
- Language specifics analysis and tools: see Matrix
- Internals: see Internals
Look in Internals.
Email to pad at fb dot com or click on "Issues" in the github project bar above.
See also Examples and Examples2.




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:
- http://research.microsoft.com/en-us/groups/hip/ and especially http://research.microsoft.com/en-us/projects/spatialcode/default.aspx
- SeeSoft
- AspectBrowser
Related old-school Unix tools:
- ctags
- cscope
- lxr
Related tools:
- Source Insight
- http://www.ndepend.com/