Programming language for self-modifying code?

Malbolge would be a good place to start. Every instruction is self-modifying, and it's a lot of fun(*) to play with.

(*) Disclaimer: May not actually be fun.


I highly recommend Lisp. Lisp data can be read and exec'd as code. Lisp code can be written out as data.

It is considered one of the canonical self-modifiable languages.

Example list(data):

'(+ 1 2 3) 

or, calling the data as code

(eval '(+ 1 2 3)) 

runs the + function.

You can also go in and edit the members of the lists on the fly.

edit:

I wrote a program to dynamically generate a program and evaluate it on the fly, then report to me how it did compared to a baseline(div by 0 was the usual report, ha).