I’m working on a draft of this idea here and would sincerely appreciate peer input as I continue working towards an implementation and really appreciate your input (as I work very very hard to try to make it both read easier and more complete).
I’ve somewhat obsessively brought up this issue of parsing ECMAScript up in meetings at least one time (every meeting that is) as this seemed to be a very common aspect across module-related discussions, where at some point, you will need to safely and effectively deal with something in the source text.
ASTs are wonderful, and I am not making an argument against them in theory, and instead just consider uses where they are not practical to be of relative importance here.
Our discussions pointed me towards Tim Disney’s work, and it is impressive all around, but leaves one feeling a little out of depth trying to work with that theory and not feel like they are missing enough of the picture to risk missing enough of the picture that they cannot risk missing.
So I went ahead and started working on a way to reason about grammar so that abstractions like those introduced by Tim Disney feel somewhat intuitive, but also be able to cover as much of the ECMAScript grammar as needed to elicit the sense of confidence desired for the task.