I’ve got a few languages I’ve been building as interpreters. When I’m ready to take ‘that next step’, what options are best for non-native compiled formats… what are the pros and cons of each?
I’ve been looking at compiling to CLR or LLVM, and contemplated C-midcompile a few times, but I’m not completely certain.
A few features I’m hoping to be able to port are as follows:
- REPL – One of the languages I’m building supports block-level evaluation during runtime.
- Robust Macros – One of the languages I’m building requires the ability to filter through code seperately before tokenizing, and in the midstep between tokenizing and parsing.
Ok, not really ‘a few’, just two. I like to think I can port any other features my languages support to ‘anything’.
What are my best options, and their pros/cons?
pro/cons:
CLR:
LLVM:
C as target language:
Java ByteCode as target:
From all the above, I think targeting Java ByteCode would probably be best for you.
EDIT: actually an answer to a comment, but 300chars are not enough.
JByteCode iffy – I agree (being a Smalltalker, JBytecode is too limiting for me).
VM-wise, I think there is a relatively wide range of performance you can get as JVM, starting at pure slow bytecode interpreters up to high end sophisticated JITting VMs (IBM). I guess, CLR VM’s will catch up, as MS is stealing and integrating all innovation anyway sooner or later, and the techniques to speedup dynamic translation are published (read the Self papers, for example). LLVM will probably progress a bit slower, but who knows. With C, you will benefit from better compilers for free, but things like dynamic retranslation etc. are hard to implement with C as target. My own system uses a mixture of precompiled and dynamically compiled code (having all: a slow bytecode interpreter, JITter and precompiled static C-code in one memory space).