so I started learning common lisp lately. It's insane how one can combine very high level language, with down-to-metal compilation. I think that's the only language allowing it? Absolutely impressive. Feels like writing python but compiling to native
Julia has similar capabilities, probably because it was heavily inspired by lisps. You can even modify Julia's compiler from within Julia. I often write code at a python level of abstraction and then use julia introspection to check the machine code that was generated.
Reader Macros in Common Lisp (2014)
31–37 of 37 posts
Re: Reader Macros in Common Lisp (2014)
#32Earlier quoted context omitted.
Julia has similar capabilities, probably because it was heavily inspired by lisps. You can even modify Julia's compiler from within Julia. I often write code at a python level of abstraction and then use julia introspection to check the machine code that was generated.
So if I understand correctly, in Julia you programmatically look at generated machine code? Is there a way to modify it, or is just for making sure some optimizations were applied?
Re: Reader Macros in Common Lisp (2014)
#33Earlier quoted context omitted.
Julia has similar capabilities, probably because it was heavily inspired by lisps. You can even modify Julia's compiler from within Julia. I often write code at a python level of abstraction and then use julia introspection to check the machine code that was generated.
So if I understand correctly, in Julia you programmatically look at generated machine code? Is there a way to modify it, or is just for making sure some optimizations were applied?
We are also working out interfaces to make it easier to programatically work on our typed IR through a technique and set of interfaces known as "abstract interpretation".
Re: Reader Macros in Common Lisp (2014)
#34Okay let me get this straight... Are you saying that I don't need to use parenthesis as much in lisp? Instead I could define a few "reader macros" and then immediately have a different syntax? Say if I wanted to change (if (test-clause) (action1) (action2)) To if (test-clause) do (action1) else (action2) Is this actually possible inline in lisp, meaning I just need to import a library that implements the if-reader-ma…
https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/...
It has test cases at the bottom. like checking that f(a)*=g(b) expands to (setf (f a) (* (f a) (g b))))
The module installs the syntax under the #i dispatch characters; you wrap the infix expression with #I( ... )
Re: Reader Macros in Common Lisp (2014)
#35Earlier quoted context omitted.
Julia has similar capabilities, probably because it was heavily inspired by lisps. You can even modify Julia's compiler from within Julia. I often write code at a python level of abstraction and then use julia introspection to check the machine code that was generated.
So if I understand correctly, in Julia you programmatically look at generated machine code? Is there a way to modify it, or is just for making sure some optimizations were applied?
Re: Reader Macros in Common Lisp (2014)
#36Okay let me get this straight... Are you saying that I don't need to use parenthesis as much in lisp? Instead I could define a few "reader macros" and then immediately have a different syntax? Say if I wanted to change (if (test-clause) (action1) (action2)) To if (test-clause) do (action1) else (action2) Is this actually possible inline in lisp, meaning I just need to import a library that implements the if-reader-ma…
This works in many Common Lisp implementations: https://readable.sourceforge.io
Re: Reader Macros in Common Lisp (2014)
#37Earlier quoted context omitted.
Out of curiosity, why not write a Scheme or Common Lisp compiler? Or just a subset?
I want an operating system from first principles. To write the smallest OS with the smallest language and the least amount of restriction. The goal is being able to replace every single part of the runtime/interpreter if you wish, but the OS itself starts with the fewest functions/features possible. cons, lambda, and the other usual suspects, a way of running actual native machine code, the homoiconicity of LISP, a r…
No offense, but if it were Common Lisp I would take a look, but I don't have much interest in learning a one off language.
Sounds like you're having so fun, though, so good luck!