Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting syntax errors due to return outside a function #11

Open
tusharsadhwani opened this issue Aug 16, 2023 · 0 comments
Open

Detecting syntax errors due to return outside a function #11

tusharsadhwani opened this issue Aug 16, 2023 · 0 comments

Comments

@tusharsadhwani
Copy link
Owner

This will require ✨Semantic Analysis✨

Essentially, the parsed AST will have to be visited by a semantic analyzer, before it is passed to the interpreter.

This semantic analyzer should do 2 things:

  • Detect any presence of return statements outside of a function
  • Detect any presence of break or continue outside of a loop

In both cases, we should raise a SyntaxError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant