back
▲ 64 points
10 comments
This is amazing! Thanks for the tip. I'm trying this out on my next game. CL is much more powerful than Lua and something I'm more comfortable with as a language. Seems to be nearly as painless integrating too.
A Lisp embedded in C++
https://github.com/rongarret/ciel
It's a toy, but it works.
Lisp is everywhere because compilers use ASTs?
Yeah, that bugged me, too.
Lisp code is written as an AST? True. C++ (and other) compilers convert code to an AST? Also true. Therefore "No matter if you are programming in Python or C++, Lisp is invariably what holds up the scaffolding behind the scenes. This is true because Lisp is the Lingua Franca of your compiler"? Non sequitur (literally, "it does not follow").
That logic boils down to "A is a C, and B is a C, therefore A is a B". No, it isn't. It would be equally (il)logical to claim that "B is an A", that is, that Lisp was a C++ compiler.
In my reading, it appears to be an assumption based on GCC, which apparently uses lisp-like code to represent its AST. (Is this true? I don't know, I haven't looked.)
Some references or more examples of compilers that use Lisp would be helpful. It was my understanding that compilers used tools based on LEX & YACC (Flex & Bison for GCC). The author mentions Clang, but Google couldn't find anything definitive that says Clang uses Lisp internally.
It only has to do with the internal usage of ASTs (abstract syntax trees) within compilers. Lisp code can be likened to an abstract syntax tree, and GCC just uses the familiar Lisp indenting rules and parenthesis syntax to output its ASTs. Therefore, I don't think compilers really use Lisp internally, it's just that they boil the code down to a form that resembles Lisp and can be conveniently output as so.
Probably because more people realize how powerful Lisp actually is.
Lisp uses ASTs. Not all uses of ASTs are Lisp, though. And no matter how many people realize how powerful Lisp is, all ASTs still won't be Lisps.
People realizing that Lisp is powerful does not fix the underlying logical fallacy.
I didn't claim that Lisp's CST (concrete syntax tree) is equivalent to C++'s AST. I just wanted to point out that more and more modern languages adopt features of Lisp, or try to embed Lisp. C++ praises lambda expressions as new feature while this feature has been around in the Lisp world for more than 50 years.
Background information about CST/AST: