Hi Edgar, I was curious about that too when I first started playing with esprima. Wonderfully, esprima (which comes pre-baked with the rules of writing code we expect - it's fun to crawl through the esprima code and see how they've done this) throws helpful errors indicating the line and column numbers of syntactic issues. As long as you catch and handle them well (for example, by indicating the issue to the user so they can fix it, as with VS Code), you should be good :)
Oh, I see. So it's the process of attempting to build the AST that uncovers syntax errors. It's not the AST itself, which cannot be built if there is such an error. Makes sense.
Ah, I see what you meant to say! It seems I played fast and loose with my phrasing in this post. Thanks for highlighting this! I’ll edit the post so it’s more accurate :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If there is a syntax error (missing brace, or bracket...) wouldn't you be unable to build the AST in the first place?
Hi Edgar, I was curious about that too when I first started playing with esprima. Wonderfully, esprima (which comes pre-baked with the rules of writing code we expect - it's fun to crawl through the esprima code and see how they've done this) throws helpful errors indicating the line and column numbers of syntactic issues. As long as you catch and handle them well (for example, by indicating the issue to the user so they can fix it, as with VS Code), you should be good :)
Oh, I see. So it's the process of attempting to build the AST that uncovers syntax errors. It's not the AST itself, which cannot be built if there is such an error. Makes sense.
Ah, I see what you meant to say! It seems I played fast and loose with my phrasing in this post. Thanks for highlighting this! I’ll edit the post so it’s more accurate :)