https://news.ycombinator.com/item?id=25531871
https://github.com/vsedach/Vacietis
================
Vacietis is a C compiler for Common Lisp systems.
Vacietis works by loading C code into a Common Lisp runtime as though it were Lisp code, where it can then be compiled or evaled. The loaded C code has the same function calling convention as regular CL code and uses the same numerical representations. C memory is backed by regular Common Lisp arrays.
Vacietis comes with a libc implemented in portable Common Lisp.
I'm not exactly sure what you mean with just "static", I'm assuming static types. But wouldn't a language with static types and a repl not be as powerful as if it was dynamic instead? In the end, you want to be able to redefine everything via the repl in your runtime, and if there is types to be checked all the time and the compiler has to do extra steps for each eval, it'll get in your way and make it harder to monkey-patch things.
A c/cpp repl would make people fiddle around and have a rapid intuition. Then they go without.
Cling- https://root.cern/cling/ (and the earlier Cint- http://www.hanno.jp/gotom/Cint.html)
I used to occasionally use them for local experimenting with libraries and language features.
A cycle that went something like:
1. Write the line to a file
2. Compile file with default flags
3. Run binary in gdb causing gdb to dump certain interest info (stack info, variable contents, etc)
4. Read the sections/symbols and merge this data into the gdb data (maybe get it from gdb)
5. Dump this data into your reply and refresh waiting for user input.
You could have a few basic commands in the repl:Modify the compiler args Add/remove/edit a line Attach gdb.
Emacs or vim could easily do this, and I suspect there are people who already do almost exactly this.
You could also just use any editor/ide with debug integration and keep a scratch file around...
We're talking about a repl here, not just a basic shell. You'll need to be able to redefine functions and everything else at runtime so a repl is all you need to run your program. A lisp with a standard repl is running miles around any editor/ide with debugger support, as the workflow with repls, especially ones that can nest on exception and so on, is much faster.
It probably won't be very fast though. There are parts of C++ that doesn't map very well to common lisp, and which means some parts will have more overhead than necessary.
> He had the wonderful idea of not implementing any undefined behaviour that wasn't strictly necessary
What does this mean? It sounds like the way an ordinary C compiler works: it ignores the possibility of undefined behaviour occurring, as the C standard allows it to do this.
If you had signed integer over/underflow it wrote insulting error messages.
http://www.hanno.jp/gotom/Cint.html
https://github.com/root-project/cling
https://www.softintegration.com
You can argue whether some of those are strictly interpreters, versus just a REPL hooked up to a compiler (as in the case of Cling). But they do exist.
p.s. here's the most concise two refs i found by googling.
https://www.quora.com/What-is-the-purpose-of-dlopen-dlload-i...
"...I decided to implement a Java Virtual Machine in Common Lisp - under normal circumstances, I wouldn't have dared to do this, because this is quite a complex undertaking, but I had read in several places that Lisp would be suitable for projects that you would normally not dare to do otherwise, so I thought I would give it a try. Over the course of 8 weeks, with something like 2 hours per day, or so (because I was still doing other stuff during the day), I was able to get a first prototype that would execute a simple "Hello, World!" program. On top of that, it was a portable (!) just-in-time compiler: It loaded the bytecode from a classfile, translated it into s-expressions that resemble the bytecodes, and then just called Common Lisp's compile function to compile those s-expressions, relying on macro and function definitions for realizing these "bytecodes as s-expressions." I was really impressed that this was all so easy to do.
The real moment of revelation was this: to make sure to reuse as many of the built-in Common Lisp features as possible, I actually translated Java classes into CLOS classes, and Java methods into CLOS methods. Java's super calls posed a problem, because it was not straightforward to handle super calls with plain call-next-method calls. Then I discovered user-defined method combinations, which seemed like the right way to solve this issue, but I was still stuck for a while. Until I discovered that moving a backquote and a corresponding unquote around actually finally fixed everything. That was a true Eureka moment: In every other programming language that I am aware of, all the problems I encountered until that stage would have required a dozen redesigns, and several attempts to start the implementation completely from scratch, until I would have found the right way to get everything in the right places."
[0] - lisp-univ-etc.blogspot.com/2012/04/lisp-hackers-pascal-costanza.html