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

REPL #67

Open
mverleg opened this issue Jul 1, 2018 · 0 comments
Open

REPL #67

mverleg opened this issue Jul 1, 2018 · 0 comments
Labels

Comments

@mverleg
Copy link
Collaborator

mverleg commented Jul 1, 2018

Is there any way to compile incrementally, while keeping in-memory state from previous compiles?

E.g.

$ let x = [1, 1];
$ for k in 0 .. 10
      x.append(x[k] + x[k+1]);

This is compiled so that, for example, x is a vector of 8-byte ints. x also has 12 specific values.

Then the next line in the repl might be

$ diff(x)
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

There are several challenges:

  • How to make this part of the original program (same types etc) without recompiling everything?
  • What if diff is diff(y: i64)? If it were one program, it'd have inferred i64 for x and it'd work, but not it might not.
  • Perhaps most challenging: how to make x refer to the same location in memory as the existing x in the already running program?

The alternative is to make an interpreter for Mango. I'd prefer to avoid duplicate effort, have compiled code, and to solve this challenge.

The rest of the repl, I hope, is just wrapping print(...) around anything that doesn't end in a ;, then reading and printing in a loop. It's the e in repl that's problematic.

@mverleg mverleg added the compile label Jul 1, 2018
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

1 participant