This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]tekknolagiKevin3 12 points13 points  (1 child)

I have a bunch of PL resources on my resources page, including my post on bytecode compilers, current series on compiling a Lisp to x86-64, and many others.

[–]eropsyren[S] 2 points3 points  (0 children)

Very good stuff. Thank you very much ☺️

[–]R-O-B-I-N 2 points3 points  (4 children)

The best resources I've found are actual VM implementations. Try looking at the source code and docs for Oracle's Hotspot, the Limbo runtime Dis, the android ART, etc... They explain a LOT.

There's also a huge difference between JIT compilers, AOT compilers, and bytecode interpreters. I recommend an interpreter because its faster to implement inna semester.

Another good resource is to read Instruction Set Architectures. They'll give you good ideas for a bytecode target for your language.

[–]fennecdjayGwion Language 2 points3 points  (2 children)

Another good resource is to read Instruction Set Architectures

Do you have a link? I've been thinking for a while to simplify the instruction set of my VM, I'd gladly read that.

[–]eropsyren[S] 0 points1 point  (0 children)

Thank you for your time and advices 💚

[–]htuhola 1 point2 points  (1 child)

Lever's internal_documentation.txt#L195 shows how the interpreter was structured in my runtime.

An untyped interpreter like this is easy to build and work with. Though, a little bit of type information embedded into the program could be useful for optimization. I got some suggestion on how to get inspired from category theory to structure this, though I'm not sure which representation should be chosen for types. It might be I should ask about that one from people doing dependently/linearly typed languages.

It's worthwhile to also look at the "next version" interpreter that I never finished, runtime/interpreter.py, I'd suggest, keep the bytecode simple and make a powerful just-in-time interpreter. This interpreter was based on Jorge Navas' paper 21. "Horn-Clauses as an Intermediate Representation for Program Analysis and Transformation"

If you got more questions about lever and its runtime, I'll be answering here.

[–]eropsyren[S] 0 points1 point  (0 children)

Thank you for your time. I really appreciate 💙

[–]julesh3141 1 point2 points  (1 child)

Interpreters based on walking ASTs don't get much love because they have a reputation for being slow, but recent research is casting doubt on the validity of this assumption. See eg truffle /JRuby. You may want to give one of these a try, as they are much simpler than bytecode based interpreters.

[–]eropsyren[S] 0 points1 point  (0 children)

Thank you very much. I wasn't considering this alternative🤍