Common Lisp № 1
It's easy to write a ngorp macro that executes its forms in reverse order:
(macrolet ((ngorp (&body ydob) `(progn ,@(reverse ydob)))) (ngorp (write-line "Line 1") (write-line "Line 2") (write-line "Line 3") (write-line "Line 4"))) Line 4 Line 3 Line 2 Line 1 Common Lisp № 2
Here's one that takes the problem very literally; the code from the question appears in program without modification:
(macrolet ((execute-prints-backwards (&body body) `(progn ,@(nreverse (mapcar (lambda (string) (list 'write-line string)) (remove-if-not 'stringp body)))))) (execute-prints-backwards //some lines of code /*code*/ print "Line1" /*code*/ /*code*/ print "Line2" /*code*/ /*code*/ print "Line3" /*code*/ /*code*/ print "Line4" /*code*/ //some lines of code )) Line4 Line3 Line2 Line1