proposal-binary-ast icon indicating copy to clipboard operation
proposal-binary-ast copied to clipboard

Validating Babylon ASTs

Open littledan opened this issue 8 years ago • 3 comments

Even if it's well-typed, Babylon ASTs permit things which are not valid JavaScript syntax (for example, module declarations in scripts). What's the idea for how to validate these ASTs? I suppose, with the "delayed early error" idea, you validate at the function granularity, when the function is actually called; this would include include not just what would be JavaScript early errors, but also anything that would be malformed about the Babylon AST--is that what you had in mind?

littledan avatar Jul 21 '17 09:07 littledan

Yes, the idea is to make this part of "delayed early error".

Yoric avatar Jul 21 '17 14:07 Yoric

Incidentally, part of the reason I recommended Shift is that well-typed Shift ASTs represent far fewer invalid programs than do well-typed Babylon ASTs - and moreover we've enumerated all the ways they can fail to.

Though I'm not sure it's all that much of a win, since presumably you'd still have to typecheck the AST.

bakkot avatar Jul 21 '17 15:07 bakkot

@littledan Yeah, that's what we had in mind.

syg avatar Jul 21 '17 16:07 syg