3 ms·
If you like that, you will probably enjoy the a language that I made called TXR. It's a Lisp dialect (TXR Lisp) plus a whole-document pattern recognition and ge
by kazinator 9y ago
If you like that, you will probably enjoy the a language that I made called TXR. It's a Lisp dialect (TXR Lisp) plus a whole-document pattern recognition and generation language. These can be used independently or in combination.
This example shows generation (with some very light extraction: munging a copyright header from existing files to stick into a generated file):
http://www.kylheku.com/cgit/txr/tree/gencadr.txr http://www.kylheku.com/cgit/txr/tree/gencadr.txr
gencadr.txr generates all those caar, cadr, caddr, ... functions down to five levels deep, in C. Plus it generates the Lisp defplace definitions for all of them so they are assignable, as in (set (caddar x) new-value).
That part could have been done in Lisp rather than textual generation, but I said what the heck.
Generated results:
http://www.kylheku.com/cgit/txr/tree/cadr.c http://www.kylheku.com/cgit/txr/tree/cadr.c
http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/cadr.tl http://www.kylheku.com/cgit/txr/tree/share/txr/stdlib/cadr.t...