Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming language for self-modifying code?

  • 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 painful.
  • 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

This is 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(); 
like image 384
Betamoo Avatar asked Jun 16 '10 21:06

Betamoo


People also ask

What is a self-modifying program?

Self-modifying programs are programs which are able to modify their own code at runtime. Nowadays, self- modifying programs are commonly used. For example, a packer transforms any program into a program with equiva- lent behavior, but which decompresses and/or decrypts some instructions.

Can you code a program to code itself?

On the Hunt for CodeDeepCoder is a machine learning system that can write its own code. It does this using a technique called program synthesis. Essentially, it creates new programs by combining existing lines of code taken from other software, which is what human coders do.

What is the most flexible coding language?

Java is one of the world's most versatile and flexible programming languages. It is used by companies throughout the world to create desktop apps and for back-end website development. One of the unique features of Java is that it can run on pretty much any operating system.


1 Answers

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.

like image 76
David Avatar answered Sep 20 '22 07:09

David