Rust LLVM - status ? #1

dbp opened this Issue Aug 16, 2012 · 3 comments

3 participants


Hi Brian,

Sorry if this is an awkward way to get in touch - I don't see another obvious thing that would go to you!

I am very interested in the interpreter idea that you were working on in the other repo, specifically the design using LLVM to run the interpreted code.

I have been going through and updating the code to match the current language (a lot has changed in 4 months), but I am sort of curious how much you had working when you were last working on it (and if you plan to continue).

After updating a bunch of stuff due to library reorganization, I can get expressions to parse, but they only work if they are things that can be parsed on the top level (ie, function definition, types, etc), which I'm not sure if is a change since you were working on it, or simply the way it was. Additionally, at least one of the passes complains if the function is not defined as main.

This leads to a question about the overall approach - is there any persisted state? Everything seems to be dealing in units of crates, which makes me thing it is not. And furthermore, that a lot of work needs to be done before even a hello world could be put out.

So, it would be great to know what the status of the interpreter was when you last worked on it, if you think you will be working on it again, and generally if you had any planned approach that didn't get into the current code.




Thanks for the interest in the project. Yes, it's still in a very nascent and incomplete state, but it looks like there is interest in having a Rust REPL so I'll try to get involved in this again. I've been working on this for several months, but progress was slow as I was a full-time college student in the meantime, and in the spring my other work kind of took over.

The overall design is modeled after cling, which is a similar project for C++: take in some code, compile it to LLVM bitcode, and execute it using LLVM's execution engine. AFAIK the current librustllvm doesn't link in the LLVM execution engine, which is why I made a fork of the whole project to have it be linked in during the build.

My vision is for this REPL to be able to read and execute rust expressions, statements, and items (e.g. function and type definitions). I started with exprs and almost got them working, I think I was in the middle of type analysis so it would print the result the right way. You mentioned persistent state between input, that's definitely a problem I have not yet solved. Also, the REPL should be able to take in meta-commands to control the REPL itself, my idea was to model it after the ":" commands that GHCI has.

Hope this is what you're looking for,


regarding bleibig/rust-repl:
[14:09:44] cinch: it currently uses some really (string) weak checks for when you define variables. so, at the moment it will probably not be that smart at reading crate linking and variable definitions - but i'm making it use rustc's lexer and AST to check it properly

@bleibig bleibig closed this Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment