Skip to main content
48 votes

Brainfuck interpreter written in C

This is a pretty reasonable start on a simple interpreter. Edward's suggestions are all good; a few additional suggestions: interpret("+++++++++++++[->.... ...
Eric Lippert's user avatar
  • 14.9k
45 votes
Accepted

Brainfuck Interpreter written in x86 Assembly

The comment ; *argv should be ; argv, since you are not yet dereferencing the pointer. After a ...
Roland Illig's user avatar
  • 21.4k
28 votes

Brainfuck interpreter written in C

Here are some things that may help you improve your program. In all, it seems to be nice, straightforward code that does what it needs to do. Good start! Use only required ...
Edward's user avatar
  • 66.6k
23 votes
Accepted

A completely overkill BrainFuck lexer/parser

Additional C#6.0 Modifications How C#6.0 would you like it to be? You still have a few places you can use more C#6.0: I'm going to work bottom-to-top in your post: Usually, I don't support using ...
Der Kommissar's user avatar
19 votes
Accepted

A brainfuck interpreter in C

Overall Observations An interpreter should be able to read from standard in as well as from a file, this would break the entire tape model. The user could also redirect an input file to standard in. ...
pacmaninbw's user avatar
  • 24.8k
16 votes
Accepted

Interactive Brainfuck interpreter in Haskell

Good job on getting it to work! I've used a string reversal program to check your interpreter and it works well. However, it also uses ~36MB of memory, which is too much. A tape goes both directions ...
Zeta's user avatar
  • 19.3k
13 votes

A brainfuck interpreter in C

Only include the header files that you need Looking at tape.h, it only contains declarations and no definitions. As such, the header files only serve to bloat up ...
Rish's user avatar
  • 2,426
10 votes

Rust Brainfuck interpreter

Profile You can only improve what you can measure. So first of all let us run callgrind to check where we spent most of our time: ...
Zeta's user avatar
  • 19.3k
8 votes
Accepted

Brainfreeze: A Brainfuck compiler in C

I'm mostly reviewing the code-gen choices, not the style / implementation of the compiler itself. The compiler itself mostly looks fine in the parts I've skimmed over (looking for how it uses the ...
Peter Cordes's user avatar
  • 3,416
8 votes
Accepted

BrainF**k interpreter in python

All of your if char == '>': ptr += 1 and similar checks should use elif after the first check. By using ...
Carcigenicate's user avatar
8 votes

A brainfuck interpreter in C

You could use perror() to give more useful information from library-call failures. For example, consider ...
Toby Speight's user avatar
  • 81.7k
8 votes
Accepted

Brainfuck interpreter in C++ with namespaces

...
Quuxplusone's user avatar
  • 19.4k
7 votes
Accepted

Text to Brainfuck translator

If you pass a long text to the code generator, the resulting program will overflow its memory. This is because you do >+++.> for each character, but you never ...
Roland Illig's user avatar
  • 21.4k
7 votes
Accepted

Brainfuck compiler with tcc backend

First off, your code does not compile, because (at least my just installed) libtcc does not contain a compile function. As far ...
Abrixas2's user avatar
  • 194
7 votes

Brainfuck to x86 Assembly Compiler

Your TargetCodeGenerator's generateAST has multiple abstraction levels embedded into one method. And it's a long method. It has all of these details that are pretty complex - when I see ...
Pimgd's user avatar
  • 22.3k
7 votes
Accepted

Portable BrainFuck Interpreter in ANSI C89

Okay, what's the deal with #define ezs(x) (x)? Is it some kind of trick to either hide C-style casts, or make them more greppable? If the latter, why such a short ...
Quuxplusone's user avatar
  • 19.4k
7 votes

Brainfuck compressor in Python

Since you seem to want code golf over readable code this may not be the answer you want. All the suggestions I make are things I would prefer, but I don't think it's that uncommon for others to ...
Peilonrayz's user avatar
  • 43.5k
7 votes
Accepted

200 line Brainfuck Interpreter

Enable more compiler warnings: ...
Harith's user avatar
  • 9,777
7 votes

Brainfuck to C transpiler

Advice I - roll your own my_basename When you fprintf(stderr, "usage: %s [input] [output]\n", argv[0]); I suggest you ...
coderodde's user avatar
  • 29.8k
6 votes
Accepted

Brainfuck with C# operator overloading

You could get slightly closer with the [] command pair. It's actually quite trivial: Add an indexer to your brainfuck class (<...
Der Kommissar's user avatar
6 votes

Optimized FizzBuzz in brainfuck

Tape setup Esolang constants are compact, but not efficient. You are using an esolang constant to get the number 61, but what you actually want is a series of numbers: 0 5 66 117 122 105 70 3 0 100. ...
Simon Forsberg's user avatar
6 votes

BrainF**k interpreter in python

+1 on specifying argument code: str and return type -> str. I implemented a class seen below which has the advantage of ...
Abdur-Rahmaan Janhangeer's user avatar
6 votes
Accepted

BrainF**k interpreter in C++

Bug The only issue I see is that the data array is never expanded. As a result any value of ptr that is not zero will cause undefined behavior. What you want to ...
Loki Astari's user avatar
  • 96.6k
5 votes

Brainfuck Brute Force

I am trying to brute force code Brainfuck code to get the desired output. For this, I need my code to be as fast as possible. I am sorry, but those two statements are impossible to combine. If you ...
Simon Forsberg's user avatar
5 votes
Accepted

Object-oriented Brainfuck interpreter

...
200_success's user avatar
5 votes

Brainfuck interpreter in C 3

CodeReview problems You've made two "codereview" errors (as opposed to "coding" errors): Use tags You didn't specify enough about your environment. What version of C are you writing for? (I'm ...
aghast's user avatar
  • 12.4k
5 votes
Accepted

Simple Brainfuck Interpreter in C

The code is easy to read and to follow. There isn't a global in sight, the indentation is consistent, you use EXIT_SUCCESS and ...
texdr.aft's user avatar
  • 258
5 votes
Accepted

Add two values in brainfuck

Shorter ways I'm sure there are shorter ways to do this What makes you so sure? There is no shorter way to shorten the moving of one cell to another. I doubt there are any shorter and more efficient ...
Simon Forsberg's user avatar
4 votes

Brainfuck Interpreter written in x86 Assembly

Jump instructions are slow and should be minimized. One jump instruction in the interpreter loop can be removed as follows: ...
CWallach's user avatar
4 votes

Reverse multiple strings separated by comma

Upon learning more brainfuck, I've learned that my loop that subtracts 44 could be improved: Before ...
Unihedron's user avatar
  • 522

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