4 ms·
This is not only possible in Lisp, this is also possible in Prolog. In Prolog, Data is code. LISP can be viewed as a specialization of Prolog, where the data
by segmondy 12y ago
This is not only possible in Lisp, this is also possible in Prolog. In Prolog, Data is code. LISP can be viewed as a specialization of Prolog, where the data structure just lists. Prolog has more complex data structure compounds, where a list is nothing more but one type of said compound structure. One can write Prolog code to emit 6502 code or any code as well, and I suspect with as much ease as he did.
Here is a sample of code generation in Prolog for register machines,
https://github.com/segmond/PrologThingz/blob/master/clause_and_effect/compilation/cg_flatten.pl https://github.com/segmond/PrologThingz/blob/master/clause_a...
An example for accumulator based machines which the 6502
https://github.com/segmond/PrologThingz/blob/master/clause_and_effect/compilation/cg_single_accumulator.pl https://github.com/segmond/PrologThingz/blob/master/clause_a...
The examples I posted is from an awesome Prolog book I read called "Clause and Effect"