126

oOo, 1569 1515 bytes Had to be done. Try it here. Golfed: ...


66

brainfuck, 843 691 bytes Edit: decided to revisit this and found a surprising number of ways to golf off bytes >>>,[>++++[-<-------->]<-[>+<<]>[----------[>]>[<+<+>>>>]<<<-[>]>[<+<+>>>>]<<<-[>]>[<+<+>>>>]<<<-[>]>[<-&...


62

Brain-Flak Classic, 1271 1247 1239 bytes <>(()){<>((([][][][][])<(((({}){})(({})({}))[])({}(({})({}({})({}{}(<>)))))[])>{()<{}>}{})<{{}}{}>())}{}<>(<(({()(((<>))<>)}{}{<({}(([][][])((({})({}))[]{})){})>((){[]<({}{})((){[]<({}{}<>((({})({})){}{}){})(<>)>}{}){{}{}<>(<(...


48

Python 2 (No STDIN) Thanks to Skulpt, it has become very easy to write a Python interpreter. function out(text) { var output = document.getElementById("output"); output.innerHTML = output.innerHTML + text; } function builtinRead(x) { if(Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined) throw "File not found: '" + x + "...


33

Befunge-93 Edit: I reworked the entire GUI now. I'm much happier with it. Some kind of breakpoint feature would be cool, but it's probably too much for this. Open Points I will probably revisit: Allow an infinite board Displaying the stack when stepping through the program would be neat Since I just implemented this interpreter for this challenge it's not ...


33

TI-BASIC 'cause who doesn't like TI-Basic? I wanted to contribute to this, so I picked a language that is (in my humble opinion) slightly more complicated than, say, Deadfish, but within my control. I know a lot about my calculator, so I picked this. I don't however, have any background experience with JavaScript/CSS/HTML. This was my first program. That ...


32

05AB1E, 5 bytes vy.V, Try it online! Explanation This challenge fit 05AB1E like a glove :) vy # for each instruction in the program .V # execute as 05AB1E code , # print


31

Vim, 809 580 bytes -229 bytes because shenanigans and balderdash. qq<C-v><C-v><C-v>q<Esc>^mbO<C-r>q elsei "<C-r>q<C-r>c"=="<Esc>^"xc$<C-r>q norm <Esc>^"zc$en<C-r>q <Esc>^"yd$i`b"cyl:if "<C-v><C-r>c"==">"<C-r>z@f&...


26

Brainfuck Here's a basic BF interpreter. There's no debugger though, but has a couple of customisation options. const NUM_CELLS = 30000; const ITERS_PER_SEC = 100000; const TIMEOUT_MILLISECS = 5000; const ERROR_BRACKET = "Mismatched brackets"; const ERROR_TIMEOUT = "Timeout"; const ERROR_INTERRUPT = "Interrupted by user"; var code, input, wrap, ...


26

Python 3, 421 414 410 404 388 395 401 bytes Golfed: import sys,re v,i,c,g,L={},0,[re.sub('( ?)[^9]+','\\1',l).rstrip().split(' ')for l in open(sys.argv[1])],lambda i:v.get(i,int(i)//9),len while-1<i<L(c): d=c[i];l=L(d);e,*f=d;i+=1 if l>1: x,*y=f if e:w=list(map(g,f));v[e]=sum(w[::2])-sum(w[1::2]) elif l==2:j=input();v[x]=int(j)if L(x)%2 ...


26

Lenguage, \$1.42 \times 10^{122}\$ bytes minus a lot of bytes thanks to Kevin Cruijssen and Bubbler hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh... This is 142099843608359281286315447494338058415442968773543757980908246691462388164856076679905341690709953072132211450166077106439 hs, which also makes it a valid Hello ...


25

*, 0 bytes Since * has no way of reading input, the default rules allow specifying that the input must be given by concatenating it onto the program. (... I think. There's an "at least twice as many upvotes as downvotes" condition that I don't have the rep to verify).


24

Jelly, 3 bytes y@/ Input is a single list: the accumulator, followed by the pairs. Try it online! How it works The y atom performs transliteration; [a,b]yc replaces a with b, so it returns b if a=c and c if a≠c. y@/ folds/reduces the input by y with swapped arguments, performing one transliteration per pair.


23

Unicorn (ES6), 5934 5278 bytes Under the custom encoding, this is 5278 bytes (1 byte per char); but with UTF-8, it would 4 bytes per char (though only 1 for a space), or 20869 total. (too many Unicorns and Goats to reasonably display here) Instead, here's a pastebin. This Unicorn code transpiles to this JS snippet: s=>eval(s.replace(/\S+ ?/g,c=>...


23

Python 3, 69 68 bytes -1 byte thanks to @WheatWizard i=0 for c in input(): i+=c==';' if'#'==c:print(end=chr(i%127));i=0 Try it online!


22

Python 3, 43 bytes lambda s:re.sub("00|11","",s)[-1] import re Try it online! The function takes a single string as input, where the first character is the initial state and the rest of the string represents the commands. This solution can be easily ported to other languages that have better support for regular expressions. The difficult part is to ...


21

Marbelous* This interpreter is probably filled with bugs; if you find any, please let me know. This supports all features of Marbelous except #include. There is also an option for using a cylindrical board (marbles shoved off the sides of the board reappear on the other side). The interpreter also comes with many boards present in the examples in the repo ...


20

JavaScript (ES6), 76 82 80 bytes s=>s.replace(/./g,c=>c=='#'?String.fromCharCode(a%(a=127)):(a+=(c==';'),''),a=0) Demo let f = s=>s.replace(/./g,c=>c=='#'?String.fromCharCode(a%(a=127)):(a+=(c==';'),''),a=0) console.log(JSON.stringify(f(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;...


20

><>, 555 bytes ffv $@$f$+1~< $>i:1+?!v:a=?^}$:@@:@{@p$1+ @@:@(?$&$>~&l1=?v: ^}f-&0~~~~&< >&1+$ff0 v :@@=?v:@@=?^:@@=?v:@@=?v:@@=?vv>}$:@@:@{@g::0$-:@(?$~&">v<;^"& v/~~&</ 2~~~&/ 1~~&/ 0~&/>~" "&>}$:@@:@{@0&-@p:&1$3=?v&:&...


19

Python 3, 770 bytes This is a REPL on stdin/stdout. Expects every line to be a full statement or empty. eval is used to shorten the implementation, but is otherwise not necessary for logic. import re,sys;S=re.sub P=lambda l:eval(S("([A-Z0-9][A-Z0-9 ]*)",r"' '.join('\1'.strip().split())",S("NIL","()",S("\)",",)",l)))) d={"QUOTE":'(v,L[1])[1]',"EQ":'[(),"T"][...


18

Retina 0.8.2, 386 391 386 bytes Code contains unprintable NUL (0x00) characters. It's also not super golfed yet, because it's already really slow, and if I golf it more, I don't know how long it'd take to finish. Appears to time out on the prime-finding sample. There may be bugs in the online interpreter or in my program (leading new lines don't show in the ...


18

DogeScript The 99 bottles of beer program: many amaze 99 time such scare bottles-of-beer such scream on-the-wall many despair 13 time such fail take-one-down-pass-it-around wow so amaze so scare so scream so despair! so amaze so scare so despair! much amaze so fail so despair! so amaze so scare so scream so despair! so despair! very amaze wow ...


18

30 fractions 37^1/41^1 43^1/47^1 41^10*31^1*13^1/37^10*29^1 1/37^10 47^9*5^1/43^9*7^1 47^9/43^9*17^1 47^9/43^9*13^1 47^9/43^9*23^1 41^1*47^8/37^1*43^8*29^1 41^6*47^3/37^1*43^8*53^2 41^2*47^7*23^1*7^1/37^2*43^7*13^1*5^1 47^9*53^2/37^2*43^7*13^1 41^3*47^6*13^1/37^3*43^6*23^1 41^2*47^7*23^1*7^1*29^1/37^3*43^6*13^1*5^1 41^3*47^6/37^3*43^6*13^1 41^4*47^5*11^1/37^...


17

Befunge-93 - 404 371 361 352 339 337 323 bytes <xyXYvp01<>110vv5_v#`0+1:_v#+!-"g"\<v"<":::<>1v#p03-1_>! g20gp00g1+0v25p v2g02 < p0 20p<+vp020p01-10$_:"p"-!^>>-!\ v^ <>0p20pv|!*-";"\+1::~p0< v2-10<^v# ^#< <<$< < ^+!-"_"\+!-"?"<&...


17

Python 2, 38 bytes lambda s,n:s.strip("()+*%n")or eval(s) Try it online! This evaluates a subset of Python 2 given by arithmetic expressions using only characters ()+*%n, acting on natural-number input n. This computes the class ELEMENTARY, as the closure of the expressions in the basis \$\{n+m, n^2, n\bmod m, 2^n\}\$ as noted in the Wikipedia article ...


16

APL (Dyalog) (326 - 8 = 318) Paste it in an editor window and call H. Input is taken from the keyboard. H ⎕←'Source code contains invalid characters'/⍨~∧/'HhQq9+'∊⍨V←⍞ B←' of beer' W←' on the wall' L←⎕TC[2] Z←{k←' bottle','s'/⍨⍵≠1⋄⍵<0:'99',k⋄⍵=0:'No',k⋄k,⍨⍕⍵} {⍵∊'Hh':⎕←'Hello, world!' ⍵∊'Qq':⎕←V ⍵∊'9':{⎕←G,K,(G←Z⍵),B,L,(⊃'Go to the store and buy some ...


16

JavaScript (sample answer) Interpreting JavaScript using JavaScript is somewhat useless, but this shows what your interpreter snippets should roughly behave like. Here is the bare bones version, intended for quick use in other posts: BEGIN_CODE // Put JavaScript code here // it may be on multiple lines END_CODE_BEGIN_INPUT Put input here it may be on ...


16

Common Lisp, 1180 857 837 836 bytes I know this is not going to win, but I had fun golfing this one. I managed to remove 343 bytes, which is more than two 99 interpreters written in CJam. Also, quite amusingly, the more I try to compress it, the more I am persuaded that for Common Lisp, it is shorter to compile the code than to try interpreting it on the ...


16

CJam, 157 bytes {:I;_N" 9"+--N/:P:,$W=){1a*Ab}%:V;{PT):T(=:LS%_{LS#\:,_,({(\{V=}%@{V-1@{2$*+0@-\}*\;t:V;}{:|T@V=9*?:T;}?}{~\{_V=\1&!{128%c}*o}{VIW):W=it:V;}?}?}R?Tg)TP,<*}g} Try it online: I/O Test G11G10G9G8G7G6G5G4G3G2G1G 99 bottles of beer (this code is too long to fit in a URL, so copy the code and paste it into the interpreter manually) ...


Only top voted, non community-wiki answers of a minimum length are eligible