Parsoid/Todo:PHP parser integration

Extension expansion
Most extensions don't depend on order and frame state, so can be expanded in parallel and out-of-order.

The following extensions depend on the frame state :
 * Arrays (frame->expand, shared state so order-dependent)
 * Carp (debugging extension, low-level frame access)
 * ExtTab / ET_ParserFunction (frame->expand)
 * FacebookOpenGraph (parser->replaceVariables, parser->recursiveTagParse)
 * HTMLTags (parser->replaceVariables)
 * HashTables (frame->expand, frame->getArguments, order-dependent)
 * LabeledSectionTransclusion (frame->expand)
 * Loops (frame->expand, frame->getArgument, order/nesting-dependent)
 * Poem (parser->recursiveTagParse)
 * RSS (parser->recursiveTagParse)
 * SelectTag (parser->recursiveTagParse)
 * SoundManager2Button (parser->recursiveTagParse)
 * Spark (parser->replaceVariables)
 * Validator (parser->recursiveTagParse)
 * WikitextLoggedInOut (parser->recursiveTagParse)

These depend on the frame state, but are run from the preprocessor only:
 * CreatePage (frame->expand)
 * GeoData (frame->expand)
 * PageInCat (frame->expand)
 * ParserFun (frame->expand, frame stack access, ...)
 * ParserFunctions (frame->expand etc)
 * RegexFun (low-level frame access)
 * ReplaceSet (frame->expand)
 * Scribunto (frame->getArguments)
 * SemanticForms (frame->expand)
 * SemanticMediawiki (frame->expand etc, not 100% sure if it registers tags too)
 * SubpageFun (frame->expand)
 * WikiLovesMonuments (frame->expand, frame->getArgument)

Run from the preprocessor only, but order-dependent:
 * UserFunctions (dynamic user-defined parser functions)

Run from the preprocessor only, but add global state:
 * Description2 (frame->expand); also adds an output hook which adds a global meta tag to the parser output

Possible solutions

 * Parse all templates in a single action=parse call, separated with unique strings so that the results can be split per template transclusion
 * Problem: Single-threaded, hides a lot of information we would like to have.


 * Instrument the PHP preprocessor to provide a serialized frame parameter for unexpanded extension tags
 * Lets us perform the expansion independently

Information we would like to get from action=expandtemplates

 * List of templates and parser functions used in the expansion
 * Lets us track dependencies and cacheability for selective re-rendering
 * Serialized frame for tag extensions in template expansion output
 * Lets us expand those extension tags with the proper frame