Page 1 of 1
Is there anything like reader-macros in Newlisp?
Posted: Fri Mar 04, 2011 2:10 pm
by Kazimir Majorinc
I remember that Ted once proposed it, but I do not remember if it was implemented on any way.
Re: Is there anything like reader-macros in Newlisp?
Posted: Fri Mar 04, 2011 6:36 pm
by TedWalther
Lutz has said "no way". Perhaps you wish to implement them, Kazimir? If the implementation didn't impact performance, perhaps he would be amenable. Especially if it could be done in 100 lines of code or so. I suspect 500 lines of code max.
Re: Is there anything like reader-macros in Newlisp?
Posted: Fri Mar 04, 2011 7:53 pm
by Lutz
Yes there are! Look into the function "reader-event" in the manual and also into the standard module macro.lsp which has a more sophisticated implementation than the simple manual example.
This does macro expansion during loading - translation in s-expressions - of newLISP source.
Re: Is there anything like reader-macros in Newlisp?
Posted: Fri Mar 04, 2011 8:49 pm
by cormullion
What's a reader macro? Is it just a pre-processor, like the reader-event already in newLISP (since 2009?), or something very different?
I googled this, and got your article as the first hit, Kazimir! :)
Re: Is there anything like reader-macros in Newlisp?
Posted: Sat Mar 05, 2011 7:45 pm
by TedWalther
Lutz, my understanding of reader macros is that they allow you to alter the syntax of the language? I thought your reader macros only did transformations on already well-formed newlisp syntax?
Re: Is there anything like reader-macros in Newlisp?
Posted: Sat Mar 05, 2011 9:59 pm
by Lutz
I thought your reader macros only did transformations on already well-formed newlisp syntax?
yes, on wellformed s-expressions.
Re: Is there anything like reader-macros in Newlisp?
Posted: Sun Mar 06, 2011 7:13 pm
by TedWalther
Thanks Lutz, that is what I thought.
Kazimir, the reader-macros currently in newlisp don't support one of the things I wanted; the ability to embed other languages in newlisp code. With recursion. I wanted to embed perl inside newlisp inside C inside newlisp... etc. Maybe add some ,@() syntax.
But newlisp is usable as is; I've been having to rework my mini-languages to be good sexps.