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

Refactor evaluator class to interpreter class visitor-pattern branch #38

Open
gravataLonga opened this issue Jul 7, 2022 · 2 comments

Comments

@gravataLonga
Copy link
Owner

There are some edges cases when function identifier isn't declare, e.g.:

var a = {"fn": add};

function add() {

};

This will give error, because add identifier isn't yet declare, we need more study on this.

@gravataLonga
Copy link
Owner Author

We are now implement this with semantic analyzer.
https://github.com/gravataLonga/ninja/tree/main/semantic.

@gravataLonga
Copy link
Owner Author

Major refactor is happening in branch visitor-pattern. We are change way we interpreter values for a visitor pattern, this way we can handle edges cases like this one. Also it will prevent leaks of variables for example

var a ="global";
function () {
   function showA()  { puts(a); }
   
   showA();
   var a = "local";
  showA();
}();  

@gravataLonga gravataLonga changed the title Edges cases when function identifier isn't yet declare Refactor evaluator class to interpreter class visitor-pattern branch Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant