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

WASM: Variable Scoping #145

Closed
pkel opened this issue Aug 20, 2020 · 1 comment
Closed

WASM: Variable Scoping #145

pkel opened this issue Aug 20, 2020 · 1 comment

Comments

@pkel
Copy link
Collaborator

pkel commented Aug 20, 2020

In its current state, the WASM backend does not correctly handle variable scoping: Wasm variables are function-scoped and the translation assumes that Imp variable names are unique. In case of nested variables with the same name we will run into unexpected behaviour.

This is not yet fixed because we were unsure about the best way of solving the problem.

I claim it's feasible (and fun) to implement scoping in the OCaml code that translates Imp to Wasm. This would have the additional benefit, that local (function scoped) variables could be reused for multiple block-scoped Imp variables, e.g. after leaving a block. Currently there is one function scoped variable per variable name occurring in the Imp function.

On the other hand, it probably makes sense to do this error prone step in the proof assistant. For that, we would probably want to have another intermediate representation that is more Wasm-like (See #146).

@pkel
Copy link
Collaborator Author

pkel commented Aug 21, 2020

Addressed in 8766b38 using OCaml. At some point it will be moved to Coq as part of #146.

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