3
Duplicate? I knew somebody must've done this before.
Programming a programming language in itself is something that has interested me since I knew what a programming language was. So I thought I'd create a Code Golf challenge for you.
Challenge
Create an interpreter for a given programming language, programmed entirely in itself. The interpreter should be able to run any valid program in that language, including itself.
Inputs:
The program can take it's input as a file passed as a parameter (e.g. python myfile.py
) or as lines from stdin (cat myfile.py | python
).
Outputs:
Whatever an interpreter would normally output, on the correct streams (stdout, stderr etc.)
Specifications
- The code needs to be written in an interpretable language, and serve as an interpreter for its own language.
- It can't use an
eval()
function to interpret code. - It must run any valid program in that language. If the language allows external modules (or includes), it must be able to read those modules.
- This task is code golf. The submission with the least characters that is correct wins. In case of a tie, the solution that was submitted first wins.
Loophole remover:
- Yes, if you can interpret Java, Bytecode or HQ9++ in themselves, go ahead!
- In JavaScript / ES, using HTML tags such as
<script>
is not allowed.
Our default scoring method is bytes, not characters, because scoring in character will likely get you answers like this. You are free to choose characters over bytes if you really want to, but I thought I'd let you know about the consequences. ;)
– Martin Ender – 2015-08-29T14:19:17.0101Seems like this might be a better popularity contest than code golf- there are many extremely degenerate non-general esolangs which have simple solutions to this problem and more interesting languages have no chance of competing. – JohnE – 2015-08-29T14:34:01.663
2Oh well, this contest is over. Loopholes should be closed not opened. – Dennis – 2015-08-29T14:40:44.023
@MartinBüttner I meant bytes! But there's no point editing now, even though the duplicate refers to an old and inactive challenge. – wizzwizz4 – 2015-08-30T07:30:14.470
is tcl
interp create
valid? – sergiol – 2017-07-06T20:46:34.043