<p>Homoiconity?</p>

<p><a href="http://en.wikipedia.org/wiki/Homoiconicity">http://en.wikipedia.org/wiki/Homoiconicity</a></p>

CC BY-SA 3.0
2011-08-02T20:24:45.717Z
2011-08-02T20:24:45.717Z
andreasw
<p>I think you have to define first what it means to be self modifying.</p>

<p>First there are textual macros. Those rewrite programs through word replacement.</p>

<p>Then there are syntactic macros. Those manipulate the abstract syntax tree. For example these can introduce new syntax easily.</p>

<p>Third there are metaprogramming and domain specific languages. These are programs that write other programs. Something like this is SQL. An example of metaprogramming would be something like a compiler that would bootstrap itself.</p>

<p>Even further a program loaded in memory can easily modify itself by changing its state. If you write to where the instructions are then this is a program that modifies itself. If you include memory as part of the program then any program that you run on your computer rewrites itself.</p>

CC BY-SA 3.0
2011-08-03T04:14:02.453Z
2011-08-03T04:14:02.453Z
Joshua Herman
<p>I am busy researching different languages just for some theoretical knowledge and came across programs that manipulate themselves. What language feature is used for this?</p>

CC BY-SA 3.0
2011-08-02T20:19:08.437Z
It depends on the programming language: http://en.wikipedia.org/wiki/Self-modifying_code.
Dave Clarke
<language-design>
What language feature allows programs to manipulate themselves?
Etienne Marais
# What language feature allows programs to manipulate themselves?

(Asked by: username_0 on 2011-08-02)

I am busy researching different languages just for some theoretical knowledge and came across programs that manipulate themselves. What language feature is used for this?

**Tags:** language-design
> **Comments:**
> **username_1**: It depends on the programming language: http://en.wikipedia.org/wiki/Self-modifying_code.  

---

## 2 answers

### Answer by username_2 on 2011-08-02. Score: 7

Homoiconity?

<http://en.wikipedia.org/wiki/Homoiconicity>


---

### Answer by username_3 on 2011-08-03. Score: 4

I think you have to define first what it means to be self modifying.

First there are textual macros. Those rewrite programs through word replacement.

Then there are syntactic macros. Those manipulate the abstract syntax tree. For example these can introduce new syntax easily.

Third there are metaprogramming and domain specific languages. These are programs that write other programs. Something like this is SQL. An example of metaprogramming would be something like a compiler that would bootstrap itself.

Even further a program loaded in memory can easily modify itself by changing its state. If you write to where the instructions are then this is a program that modifies itself. If you include memory as part of the program then any program that you run on your computer rewrites itself.


---

