3
$\begingroup$

I stumbled across Terra last year, and the most similar language I can think of is Julia. Terra is inspired by and uses Lua for templating/metaprogramming instead of being derived from e.g. the Lisp or ML families, but like many JITted language implementations it blurs the line between compile-time and run-time.

Are there any other low-level (no VM, small runtime, etc.) programming languages I'm missing that can compile and run code at runtime (besides assembly)? Maybe Forth-likes, or Extempore's xtlang? Terra calls this (multi-)staged programming.

$\endgroup$
9
  • $\begingroup$ I did say system/low-level, and I'm not asking how one makes such a programming language but rather if any others have already been made. Since this is a yes-or-no question, I guess I should accept the first answer. Other answers would be valuable too. $\endgroup$ Commented Jun 27, 2016 at 2:07
  • $\begingroup$ Ok, fair enough, but this takes us to yes/no questions. And the answer to the title: no, which you have put into the question already. And the part that the languages can compile, well first of all the language does not compile and since this makes difference to you that some language impl. use JIT, has compiler attached etc. and Terra does multi stage, which does not substantially differ from other JITted techniques and templates, so please clarify what you are looking for. MetaOCaml for example? $\endgroup$
    – Evil
    Commented Jun 27, 2016 at 2:45
  • $\begingroup$ Terra is weird because it's a language that assumes a second one, so the word refers to the part of or the whole system, but what do you mean by 'no' and 'language does not compile'? Lang-versus-implementation nitpick? MetaOCaml doesn't compile system/low-level code, does it? $\endgroup$ Commented Jun 27, 2016 at 2:54
  • $\begingroup$ Yes, just that nitpick. There are abandoned environments like DyC, TCC with libtcc for including compiler into executable. But it was/is confusing, Julia is low/level? Isn't it interpreted And Terra is not either, it is just templating system etc, but working with lua it uses LLVM underneath, so including annotations and then using existing LLVM or libtcc or whatever is the very same. So could you specify what you are looking for directly? $\endgroup$
    – Evil
    Commented Jun 27, 2016 at 3:23
  • $\begingroup$ I didn't mean to imply that Julia fit the criterion of the question. You're right that the Lua side makes the LLVM calls, but Terra considers Lua part of itself in the way that the C++ template language is part of modern C++. The TCC you linked to, is it the same TCC that `C used? Quite an origin story, then. $\endgroup$ Commented Jun 27, 2016 at 3:34

2 Answers 2

1
$\begingroup$

No. So far the only ones I've found are pretty obscure/old, both variations of C:

$\endgroup$
0
$\begingroup$

Graphics programming languages like OpenGL and Metal often get compiled at runtime. Because at build time you don't even know what processor the code will run on, and the code to be compiled might itself be constructed at runtime.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.