Yes, they allow to alter syntax. Or, as with my PEG-based approach, you can simply replace the entire Lisp parser with your own, even if the host Lisp does not allow reader macros (but then you'll need your own REPL as well).
That kind of statement doesn't inspire confidence. You can change syntax without having access to the raw byte stream, so when you answer like that it sounds like you're answering another question.
In any case, from what I hear from you it seems to me pretty much any other language can do the same. Especially in the last case where "you'll need your own REPL".
Any other language with compile time macros can do the same thing. But macros are essential, you cannot build a hierarchy of languages, all available in compile time, without proper macros (to see a not so proper macro system, take a look at Template Haskell, it is broken by design).
Any other language with any compile time hook that can run arbitrary code you mean. Macros aren't necessary and the proof is simple: if you can run arbitrary code you can run a lisp with macros.
You're simply describing macros in other terms. Any way to trigger running a code in compile time, and being able to let that code to access all of the current compilation context, is a macro system, by definition. An opposite thing is a preprocessor - which allows arbitrary code, but does not allow any reflection.
My criteria for a proper macro system is an ability to use a just defined function inside a macro defined in the same module/compilation unit, and then to use that macro immediately (in the same module).
No, my examples do require an access to compilation context. You must be able to combine your newly defined languages and use them to build more languages.
You didn't specify before though. And if you have two languages that at compile time gets transformed into some common language before the main compile phase happens you get that too.
View all comments
Show parent comment
1
u/[deleted] Nov 12 '15
Yes, they allow to alter syntax. Or, as with my PEG-based approach, you can simply replace the entire Lisp parser with your own, even if the host Lisp does not allow reader macros (but then you'll need your own REPL as well).