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

Handling imports-declarations #38

Open
herrlax opened this issue Apr 18, 2016 · 1 comment
Open

Handling imports-declarations #38

herrlax opened this issue Apr 18, 2016 · 1 comment
Labels

Comments

@herrlax
Copy link
Collaborator

herrlax commented Apr 18, 2016

There is no obvious place to put the handling of import-declarations. A new datatype in Declaration in the AST would preferably be used, thus making the import available in the interpreter. A problem arises from this due to the fact that it's the REPL (loli.lp) that handles loading of files and not the actual interpreter.

@JonasDuregard
Copy link

Handling modules could require quite a bit of work. It would be nice to do it, but other things are higher priority.

From the interpreters perspective a module could be viewed as an environment (map from identifiers to values). Each loaded module would be stored in memory as a separate environment, and you would have a map from module names to their environments. Then when loading a module you would have to add its environment to the start environment for that module. If the module has not already been loaded you would have to recursively load it first. So you would have a kind of meta-environment that maps module names to their environment. For the type checker you do the same thing but with type environments.

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

No branches or pull requests

2 participants