Skip to main content
67 votes

Write a brain-flak classic interpreter!

Brain-Flak Classic, 1271 1247 1239 bytes ...
Nitrodon's user avatar
  • 10.8k
42 votes

r flag my Vyxal

05AB1E, 15 12 10 9 bytes -1 byte thanks to Kevin Cruijssen! This could be 8 bytes without the l, but why would I remove that? ...
ovs's user avatar
  • 60.6k
25 votes

Interpret Befunge-93

Befunge-93 - 404 371 361 352 339 337 323 bytes ...
quintopia's user avatar
  • 4,138
19 votes

Implementing a stack

MATL, 6 bytes "@?@}x Input is a row vector of numbers. The final stack is shown upside down, with the most recent element below. Try it online! Or verify all ...
Luis Mendo's user avatar
  • 105k
16 votes

Interpret ><> (Fish)

><>, 443 bytes ...
Jo King's user avatar
  • 47.5k
16 votes

Golf a Brain-Flak Integer

Brain-Flak, 64664 Try it Online! Here is my annotated code ...
Wheat Wizard's user avatar
  • 100k
13 votes

Implementing a stack

Java (JDK 10), 42 bytes Since "[the] output is flexible [...], the only thing that matters is the order", this changes the input array into a 0-terminated array. ...
Olivier Grégoire's user avatar
13 votes

r flag my Vyxal

brainfuck, 83 bytes ...
Nitrodon's user avatar
  • 10.8k
13 votes

Implement a simple stack language

Regex (PCRE 2), 104 bytes (60 + 46) +2 bytes to properly remove excess spaces after ~ commands Search: ...
mousetail 'he-him''s user avatar
12 votes

Implementing a stack

PowerShell, 46 41 40 bytes $args|%{$x,$a=&({1,$_+$a},{$a})[!$_]};$a Try it online! Takes input via splatting, e.g., ...
AdmBorkBork's user avatar
  • 43.5k
12 votes

Implementing a stack

Sed, 17 Bytes :;s/[0-9]\+,0//;t -3 bytes thanks to @OMᗺ, -1 thanks to @eggyal Because you're guaranteed to never pop an empty list, you don't need anything more ...
Tacroy's user avatar
  • 221
12 votes

r flag my Vyxal

Vyxal, 18 12 8 bytes (n:Ǎ[∇pp Try it Online! -5 thanks to @AUsername and -1 to an extra golf on that golf but then another -4 from A Username The irony here is ...
lyxal's user avatar
  • 34.3k
11 votes

Implementing a stack

C (gcc), 62 60 56 55 bytes -2 -6 bytes thanks to l4m2 -1 byte thanks to ceilingcat. Uses the permitted notion of -1 terminated arrays. f() calls itself ...
gastropner's user avatar
  • 4,413
11 votes

Implement a simple stack language

TypeScript's type system, 206 205 bytes ...
noodle person's user avatar
10 votes

Implementing a stack

R, 45 bytes o={};for(e in scan())o="if"(e,c(e,o),o[-1]);o Try it online! -4 byte thanks to @Giuseppe
digEmAll's user avatar
  • 5,029
10 votes

Implementing a stack

Haskell, 28 bytes foldl(#)[] (_:s)#0=s s#n=n:s Try it online!
nimi's user avatar
  • 35.9k
10 votes

Implementing a stack

Jelly, 6 bytes ṣ0Ṗ;¥/ Try it online! How it works ...
Dennis's user avatar
  • 211k
10 votes

Implement a simple stack language

JavaScript (Node.js), 103 bytes -2bytes by l4m2 p=>p.split` `.reduce(([a=[],b=[],...S],i)=>[{A:a+b,S:b-a,X:[b,a],P:b}[i]??[1/i?+i:a,a,b],S].flat(2),[]) ...
tsh's user avatar
  • 35.6k
9 votes

Solve a Stack State Diagram

Python 3, 84 bytes lambda n,*s:"DLL"+"L".join(i*"SLSC"+"LSLSCDURLCULCULSC"for i in s[::-1])+n*"SR"+"UR" Usage: ...
orlp's user avatar
  • 39.2k
9 votes

Make an interpreter for yes!

JavaScript (ES6), 218 215 204 203 bytes Takes the program string s and the input i in currying syntax ...
Arnauld's user avatar
  • 198k
9 votes

Implementing a stack

Brain-Flak, 40 36 bytes ([]){{}{({}<>)<>}([]){{}<>}{}([])}<> Try it online! Thanks to @Nitrodon for -4 bytes. Since Brain-Flak already ...
Dorian's user avatar
  • 3,045
9 votes

Implementing a stack

Python 2, 59 57 51 bytes s=[] for x in input():s=(s+[x],s[:-1])[x<1] print s Try it online!
ElPedro's user avatar
  • 6,469
9 votes

Implementing a stack

Wolfram Language (Mathematica), 28 bytes #//.{a___,b_,0,c___}:>{a,c}& Try it online!
JungHwan Min's user avatar
  • 13.9k
9 votes

Implementing a stack

Python 2, 48 bytes s=[] for x in input():s=([x]+s)[2*0**x:] print s Try it online!
xnor's user avatar
  • 147k
9 votes

r flag my Vyxal

K (ngn/k), 34 33 bytes {$[y<58;x,y;(-2_x),,(,/2#|x),y]}/ Try it online! A single neat K scan. Returns a singleton list with the output. -1 byte from Traws. ...
Razetime's user avatar
  • 27.4k
9 votes

Could you massage this stack for me?

K (ngn/k), 42 bytes {,//a,({(x#2;|!3;x#,3 0)}'x?y),2+a,2+a:~x} Try it online! Verify the test cases! Takes the input as two lists of positive integers (or chars). ...
Bubbler's user avatar
  • 78.4k
8 votes

Golf a Brain-Flak Integer

Lua 5.3, 57522 I actually started working on this back when the question was posted, but forgot about it until the Brain-Flak anniversary. ...
tehtmi's user avatar
  • 526
8 votes

Write a brain-flak classic interpreter!

APL (Dyalog Classic), 146 bytes ...
ngn's user avatar
  • 15.3k
8 votes

This is how we roll

Haskell, 64 62 bytes Edit: -2 bytes: @xnor saw something I'd thought wrong about. r takes and returns a list of Ints. ...
Ørjan Johansen's user avatar
8 votes

This is how we roll

JavaScript (ES6), 49 47 bytes (t,d,...a)=>a.splice(t=(t%d+d)%d,d-t).concat(a) Edit: Saved 2 bytes thanks to @Shaggy by taking the stack elements as separate ...
Neil's user avatar
  • 177k

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