I wrote one. It's 663 lines and about 12K of C code, implementing a crappy Forth-ish language. Anyone else like to make these?
I wrote one. It's 1 line and about 14 bytes of Perl code, implementing a complete Perl-ish language.
P.S.: it involves eval
Long ago I wrote a basic interpreter in basic.
Suffice to say, it sucked in every way imaginable. Besides redefining slow, it was horribly limited because it didn't build a parse tree.
A couple years later I did it in C. It was the same suckage, just faster.
I keep meaning to write gcc frontends to SNUSP and Intercal, but I've never got around to it.
>>6
That's 15 bytes. Try eval while(<>)
for 14.
By the way, the actual shortest interpreter ever is I
.
http://esolangs.org/wiki/CHIQRSX9_Plus
>>7
You can shave off a couple of bytes by losing the brackets: eval while<>
And you can then shave off a few more by changing the while loop to a for loop: eval for<>
. However, this also changes it from reading a line at a time to reading the whole input file at once (into a list), so it'll be potentially memory-heavy (arguably defeating the purpose of shaving those bytes off to begin with...)
>why I like PHP
>better maintainability
LOL
Relevant:
http://tjaden.strangesoft.net/sizehack/
This is an unfinished game implementing a forthish compiler and VM in 556 lines. This was the inspiration for the interpreter in >>1.
fabrice bellard (author of tinycc) entered a one page C interpreter in the obfuscated C code contest. I think there were other 1 or 2 page interpreters and compilers in there.
http://www1.us.ioccc.org/years.html
Note the contest entry is unformatted. You have to look for the human-readable, documented version. And Fabrice has a website with tinycc and its predecessors.
>>10
Oh yeah? Show me PHP code that does the same thing as perl's <> and is as well established, as well documented, as completely foolproof and as trivial to use again and again (because you will) without messy copy-and-pasting. Go on.
>"magic" like <>
??? lol wtf. The diamon operator is probably one of the best things to use about perl, it's hecka awesome. By the way, early PHP was programmed in Perl, so you are DQN.
> eval while<>
> eval for<>
you can also do
$^X ARGV
...
$^X?
>>18man perlvar