Programming language for self-modifying code?

Betamoo picture Betamoo · Jun 16, 2010 · Viewed 19k times · Source
  • I am recently thinking about writing self-modifying programs, I think it may be powerful and fun. So I am currently looking for a language that allows modifying a program's own code easily.
  • I read about C# (as a way around) and the ability to compile and execute code in runtime, but that is too hurting.
  • I am also thinking about assembly. It is easier there to change running code but it is not very powerful (very raw).

Can you suggest a powerful language or feature that supports modifying code in runtime?

Example

That what I mean by modifying code in runtime:

  Start:
  a=10,b=20,c=0;
  label1: c=a+b;
  ....
  label1= c=a*b;
  goto label1;

and may be building a list of instructions:

  code1.add(c=a+b);
  code1.add(c=c*(c-1));
  code1. execute();

Answer

David picture David · Jun 17, 2010

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.