Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


Tools for code analysis, visualizations, or style-preserving source transformation.

Subscribe to updates I use pfff

Statistics on pfff

Number of watchers on Github 2406
Number of open issues 36
Average time to close an issue 22 days
Main language OCaml
Average time to merge a PR 23 days
Open pull requests 6+
Closed pull requests 6+
Last commit over 3 years ago
Repo Created almost 10 years ago
Repo Last Updated 2 months ago
Size 34.5 MB
Homepage http://github.com...
Organization / Authorfacebookarchive
Latest Releasev0.29
Page Updated
Do you use pfff? Leave a review!
View open issues (36)
View pfff activity
View TODOs for pfff (726)
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating pfff for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Build Status

pfff is a set of tools and APIs to perform static analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code. There is good support for C, Java, Javascript and PHP. There is also preliminary support for other languages such as C++, Rust, C#, Html, CSS, Erlang, Lisp, Haskell, Python, OPA and SQL. There is also very good support for OCaml code so that the framework can be used on the code of pfff itself.

For each languages there are mainly 2 libraries, for instance parsing_php.cma and analysis_php.cma, that you can embed in your own application if you need to process PHP code. See the demos/ directory for example of use of the pfff API. See also docs/manual/Parsing_xxx.pdf and docs/manual/Analyzis_xxx.pdf for more documentation on how to use or extend pfff.

pfff is also made of few tools:

  • pfff, which allows to test the different parsers on a single file
  • scheck, a bug finder
  • stags, an Emacs tag generator
  • sgrep, a syntactical grep
  • spatch, a syntactical patch
  • codemap, which is a gtk and cairo based source code visualizer/navigator/searcher leveraging the information computed previously by pfff_db and codegraph.
  • codegraph, a source code indexer and package/module/class dependency visualizer
  • codequery, an interactive tool a la SQL to query information about the structure of a codebase using Prolog as the query engine
  • pfff_db, 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/db.json)

For more information, look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main as well as the docs/manual/ directory.

Usage for pfff:

$ ./pfff -parse_php demos/foo.php


$ ./pfff -dump_php demos/foo.php

You can also look at ./pfff --help

Usage for pfff_db:

$ ./pfff_db -lang ml -o /tmp/pfff.json ~/pfff

to analyze all the .ml and .mli files under ~/pfff and store metadata information (the database) in /tmp/pfff.json

Usage for codemap:

$ ./codemap ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code and perform some code search.

Usage for codegraph:

$ ./codegraph -lang cmt -build ~/pfff

to generate a graph_code.marshall file in ~/pfff containing all dependency information about the pfff codebase using the typed bytecode .cmt files generated during the compilation of pfff.

$ ./codegraph ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code dependencies.

More information

Look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main

pfff open issues Ask a question     (View All Issues)
  • almost 4 years OPAM installation failed
  • about 4 years No support for local variable in `codegraph`?
  • about 4 years Error while running codegraph on Mac OS X 10.11.3
  • over 4 years [spatch] Meta variables reformatted during patching
  • almost 5 years Codegraph unknown option -lang
  • about 5 years failed to build on MacOSX 10.10 on file 'utils_js.cmi'
  • about 5 years sgrep cannot identify calls to a static method within the same class
  • about 5 years php parsing issue
  • about 5 years How is new language support added?
  • over 5 years Scheck does not detect bugs
  • over 5 years sgrep on ternary operator in C/C++
  • over 5 years "2" appended for Not found packages (java)
  • over 5 years codequery assumes that implements/mixins exists
  • over 5 years File "main_codegraph.ml", line 263
  • over 5 years Bad annotation: deprecated
  • over 5 years OSX Yosemite 10.10.2 + Homebrew
  • over 5 years Create online pfff interest groups
  • over 5 years Support for Java 8
  • over 5 years Could this adapted to work with srclib?
  • over 5 years allow building with external libraries
  • almost 6 years prettyphp reorders statements following PHP open tags and comments on the same line
  • almost 6 years Support PSR conventions when prettifying PHP code
  • about 6 years Install: OSX 10.10 developer preview + Xcode 5.1.1 error
  • over 6 years Can't use spatch to wrap a function call
  • over 6 years Can't find binaries after installation
  • almost 7 years cant use namespace in spatch(in scan for, can use in substitute)
  • almost 7 years Codemap blank view at startup
  • almost 7 years parsing issue (javascript)
pfff open pull requests (View All Pulls)
  • Serializes graph from pfff to JSON (GraphSON) format
  • Codegraph with novisual option
  • Codegraph/java: eges drawn for methods
  • Disambiguate PHP shortform ternary
  • Adding Code of Conduct file
  • Adding Contributing file
pfff questions on Stackoverflow (View All Questions)
  • make inconsistent assumptions over interface Piqobj_to_xml "Pfff"
Other projects in OCaml
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark