Description
I see that this proposal has been inactive for some time, but given that it has not yet been withdrawn, I assume there is still at least some interest in the functionality. If it's not too much trouble, I'd like to get some feedback from the champions on an alternative/addition I've written a draft proposal for:
https://es.discourse.group/t/proposal-parser-augmentation-mechanism/2008
This defines (or will define, when complete) a standards-conforming way to describe alternate parser implementations that can be used by ECMA262-compliant engines. The Binary AST importer could be considered the simplest form of such an alternative parser, as its polyfill/validation would consist simply of reading the binary AST and submitting it unchanged to the parser API.
Note that the parser augmentation proposal is not a proposal for runtime-programmable parsing. It doesn't exclude the possibility of engines using the reference implementations as runtime parsers (the polyfill narrative), for example during development, but the primary goal of the proposal is to provide a way to describe native engine functionality, like a Binary AST-enabled browser, or like Deno's inbuilt support for TypeScript (the validation narrative).
If this proposal passes, it would allow the Binary AST to be developed and implemented separately from the TC39 proposal process, much like Flow and TypeScript are. Industry collaborations could define the best form of the AST for optimal performance, and engines could choose to implement them using vendor-defined identifiers, the way that CSS extensions are. Runtimes could use parser feature detection to select and import an AST representation based on which is known to load the most quickly in the running engine, like srcset
does for media sources. And, since every alternative parser will be required to define a reference implementation, it would not splinter the ecosystem; rather, it would unify it, since every engine would gain the potential to parse every format.
If that happens, the Binary AST proposal becomes much simpler: rather than asking TC39 to bless a particular representation as the One True AST Of ECMAScript, it will simply be a proposal to standardize the identifiers of a parser implementation already in (hopefully) widespread use.
Activity