Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
399 lines (288 sloc) 9.42 KB
% Prelude
%cf also some \newif below
%thx to LP, changed for the better a few things :)
% - have a ast_php.mli, as no more copy paste problem :)
% - factorized copyright
% - TODO factorise lexer code in different rules. Enable reproduce
% features from flex.
% TODO grouped eof stuff, AOP
% - TODO better separation of concern for tags like cocci_tag, comment_tag,
% and type tag in expression. Closer to their related code (AOP style)
% - in AST, types are closer. Can put type alias closer to their
% related constructors
% - clearer understanding of AST types, for instance static_scalar does
% not have to be in expression, in can be closer to its 'declare'
% - in lexer, mix the regexp aliases with their respective rules for
% the other stuff
% - in lexer, the regexp aliases and rules are closer to each other
%history LP-ization:
% - intergrate ast.mli (and as had to cos shared code)
% - integrate other user-oriented .mli (public API)
% - integrate grammar and lexer
% - wrote the intro
% - integrate auxillary .ml files
%could mix the ast def and grammar rules now that use LP.
% Packages
%note: allow chunk to be on different pages, so less white space at
% bottom of pages
\def\nwendcode{\endtrivlist \endgroup}
%note: required by noweblatexpad for the \t \l \n in this file
\def\backref{{\footnotesize cited page(s)}~}%en: \def\backref{{\footnotesize cited page(s)}~}
%define: \toprule
%define: \includegraphics
% Macros
% Config
% Title
{\Huge Pfff: Parsing PHP}\\
{Programmer's Manual}
and Implementation
Yoann Padioleau\\
%dup: authors.txt
%dup: with section Copyright
Copyright \copyright{} 2009-2010 Facebook \\
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3.
% if implem is included, then the doc contains the full source code
% so the copyright should be GPL ?
\hypersetup{colorlinks=true, linkcolor=blue}
\shorttoc{Short Contents}{0}
\shorttoc{Short Contents}{0}
% Body
\t test todo
\l test less
\n test note
#include "Parsing_php_intro.tex.nw"
\part{Using \pfff}
\chapter{Examples of Use}
#include "Parsing_php_use.tex.nw"
\chapter{Parsing Services}
We now switch to a more systematic presentation of the \pfff API
starting with its first entry point, the parser.
#include "parse_php.mli.nw"
\chapter{The AST}
#include "ast_php.mli.nw"
\chapter{The Visitor Interface}
#include "visitor_php.mli.nw"
#include "map_php.mli.nw"
\chapter{Unparsing Services}
#include "unparse_php.mli.nw"
#include "export_ast_php.mli.nw"
\chapter{Other Services}
This chapter describes the other services provided by
files in [[parsing_php/]]. For the static analysis
services of \pfff (
%copy paste of Parsing_php_intro:
control-flow and data-flow graphs,
caller/callee graphs,
module dependencies,
type inference,
source-to-source transformations,
PHP code pattern matching, etc),
see the [[Analysis_php.pdf]] manual.
For explanations about the semantic PHP source code
visualizer and explorer [[pfff_browser]], see
the [[Gui_php.pdf]] manual.
\section{Extra accessors, extractors, wrappers}
#include "lib_parsing_php.mli.nw"
\t ?
\section{Debugging \pfff, [[pfff -<flags>]]}
#include ""
\section{Testing \pfff components}
#include "test_parsing_php.mli.nw"
#include "unit_parsing_php.mli.nw"
#include "meta_ast_php.mli.nw"
\section{Interoperability (JSON and thrift)}
We have already described in Section~\ref{sec:unparsing-json}
that \pfff can export the JSON or sexp of an AST. This makes it possible to
somehow interoperate with other programming languages.
TODO thrift so better typed interoperability
See also [[pfff/ffi/]].
\part{\pfff Internals}
\chapter{Implementation Overview}
#include "Parsing_php_implem.tex.nw"
\fi %ifimplemoverview
#include "lexer_php.mll.nw"
#include "parser_php.mly.nw"
\chapter{Parser glue code}
#include ""
\chapter{Style preserving unparsing}
#include ""
\chapter{Auxillary parsing code}
#include "" mostly autogenerated
#include ""
#include ""
%ifwant repetitive ...
#include ""
#include ""
<<basic pfff module open and aliases>>=
open Ast_php
module Ast = Ast_php
module Flag = Flag_parsing_php
\fi %\ifimplem far far away
\chapter{Remaining Testing Sample Code}
#include ""
#include ""
%todo_lp: separate index with letters
%\subsection{Code Chunks}
%todo: need special support, cf smldefs
\bibitem[1]{wp-literate-programming} Donald Knuth,,
{\em Literate Programming},
\bibitem[2]{noweb} Norman Ramsey,
{\em Noweb},
\bibitem[3]{syncweb} Yoann Padioleau,
{\em Syncweb, literate programming meets unison},
\bibitem[4]{php-manual} Hannes Magnusson et al,
{\em PHP Manual},
% use php itself :)
\bibitem[5]{dragon-book} Alfred Aho et al,
{\em Compilers, Principles, Techniques, and tools},
\bibitem[6]{modern-compiler-ml} Andrew Appel,
{\em Modern Compilers in ML},
Cambridge University Press
\bibitem[7]{common-pad-manual} Yoann Padioleau,
{\em Commons Pad OCaml Library},
\bibitem[8]{ocamltarzan} Yoann Padioleau,
{\em OCamltarzan, code generation with and without camlp4},
\bibitem[9]{design-pattern-book} Eric Gamma et al,
{\em Design Patterns},
\bibitem[10]{design-pattern-norvig} Peter Norvig,
{\em Design Patterns in Dynamic Programming},
\bibitem[11]{coccinelle-eurosys} Yoann Padioleau, Julia Lawall,
Gilles Muller, Rene Rydhof Hansen,
{\em Documenting and Automating Collateral Evolutions in Linux Device Drivers}
Eurosys 2008
{\em Coccinelle: A Program Matching and Transformation Tool for Systems Code},
{\em XHP},
\bibitem[12]{cil} George Necula,
{\em CIL},
% Postlude
Jump to Line
Something went wrong with that request. Please try again.