WEBGL_shader_ast is a neat idea, but that would require a large spec if it was a WebGL extension, and it would add possibly unwanted constraints on how the parsing infrastructure in browsers should work.
Implementing that as a JS library might actually be less effort. In this case the additions to the API are minimal. Also, one important goal here is to make using the emulation as easy as possible. To that end, just a few added lines of code is much better than integrating a big library to a JS app
I come up with an alternative on how toggling the emulation on a shader-by-shader basis should work, by the way - using a "#pragma webgl_disable_precision_emulation;" directive in shaders could be simpler to both understand and implement. Thoughts on this?