~/talk

Climbing the Abstract Syntax Tree

slides:none on file

PHP 7 adds an actual Abstract Syntax Tree between parser and compiler so compilation becomes 10–15% faster at the cost of more memory; the AST is a mutable data structure that supports constant folding and code generation (unparse) but may change formatting. Demonstrations include a tiny PHP lexer/parser/compiler that builds and executes an AST, use of PHP AST extension by Nikita Popov and the slower php-parser (userland) fallback, and a better-reflection proof‑of‑concept that monkey‑patches method bodies (setBodyFromClosure) which works in demos.

AI-written summary · about

  1. 0:00Introduction to PHP internals
  2. 1:50Lexical analysis
  3. 5:22The parser and AST
  4. 10:07Understanding the AST
  5. 15:42Traversal and compilation
  6. 20:17Building a custom compiler
  7. 26:12Compiler execution
  8. 29:03Userland AST tools
  9. 34:06Reflection and monkey-patching
  10. 40:41Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.