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
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
  • 67.2k
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.7k
11 votes
Accepted

A tree of polymorphic types (Crafting Interpreters Book)

Unique pointers own objects It's important to realize that std::unique_pointer does not only free memory automatically, it also restricts copying pointers, such ...
G. Sliepen's user avatar
  • 69.3k
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.7k
9 votes
Accepted

Interpreter for NLRNIS programming language, written in Python

To build a language with good quality code requires understanding the various approaches to building operators, evaluators and tokenizers. Lets go through the concepts from simplest to complicated, to ...
Peilonrayz's user avatar
  • 44.6k
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
Accepted

Brainfuck interpreter in C++ with namespaces

...
Quuxplusone's user avatar
  • 19.7k
8 votes

A tree of polymorphic types (Crafting Interpreters Book)

Enable more warnings so your compiler can help you Many problems can be diagnosed automatically, prior to human review. For example, using GCC: ...
Toby Speight's user avatar
  • 88.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.7k
7 votes
Accepted

200 line Brainfuck Interpreter

Enable more compiler warnings: ...
Madagascar's user avatar
  • 10.1k
6 votes

Starting point for a collaboratively developed golfing language interpreted in Python

Object programming Y'ouve split your code into various classes. Yet, it seems like the way you use them could be improved. Indeed, the various "is_SOMETHING" method are very suspicious, both in the ...
SylvainD's user avatar
  • 29.8k
6 votes

Simple interpreter written in Rust

Learn to love rustfmt. It will correct your code to the idiomatic Rust style. Learn to love clippy. It will provide more lints to change your code to be more idiomatic. For example, it identifies many ...
Shepmaster's user avatar
  • 8,798
6 votes

JIT-based programming language

Overall code is written in a uniform style - good. Separate Code There is far too much code in one file. And even that is not organized enough. This is unmanageable and increases review/...
chux's user avatar
  • 36.4k
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
  • 97.7k
6 votes
Accepted

Simple scripting language (interpreter) in C

Potential bug str[strlen(str) - 1] is undefined behavior when str[0] == 0. Instead use a logical AND. ...
chux's user avatar
  • 36.4k
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.6k
5 votes

Starting point for a collaboratively developed golfing language interpreted in Python

There's a lot of code here, so I'm going to go through it very sketchily. If you need a point explaining in more detail, ask. There's no documentation. What is the specification of the language being ...
Gareth Rees's user avatar
  • 50.1k
5 votes
Accepted

(Lisp in (Rust))

Organization Let's first take a look at the organization of the code. The gigantic code block is stored in one file, with comments like /* Types */ and ...
L. F.'s user avatar
  • 9,705
5 votes
Accepted

Very simple interpreter in C

There are a number of issues in this very short program. Unless there are coding standards that require otherwise, it is better to use typedef to define types ...
pacmaninbw's user avatar
  • 26.1k
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
  • 268
5 votes

Simple scripting language (interpreter) in C

Boolean type If you really want / need a boolean type, use <stdbool.h>. If you don't, just use an int as much prior code ...
Deduplicator's user avatar
  • 19.9k
5 votes

Extensible typing system for a strongly-typed DSL

General Observations This is a personal preference, but I really don't like code that overuses macros: it is very hard to debug and maintain. This question has horizontal scroll bars which is an ...
pacmaninbw's user avatar
  • 26.1k
4 votes
Accepted

Haskell Brainf*ck interpreter: runtime error handling

When you compile a language, you usually split the input into tokens with a lexer, then parse those tokens with a parser into syntactic elements in an abstract syntax tree (AST) and then use that to ...
Zeta's user avatar
  • 19.7k
4 votes

Brainfuck interpreter in F# (by a C# developer)

...
200_success's user avatar
4 votes
Accepted

Befunge-93 interpreter in Python

Here are some improvement you can do gather the four directions >,<,^,...
Aries_is_there's user avatar
4 votes

Peter Norvigs' lis.py in c++17

Is std::list the best choice for the List datatype? There are a couple of places where using operator[] would make the code a little easier to read but std::list doesn't provide that. On the other ...
bipll's user avatar
  • 998
4 votes

115 line brainfuck interpreter written in C++

I see some things that may help you improve your program. Use all of the required #includes The function std::strchr is used ...
Edward's user avatar
  • 67.2k
4 votes
Accepted

115 line brainfuck interpreter written in C++

Design You do not validate that the program is valid before starting. You should check that '[' and ']' are all matched correctly. This can be done while loading the program. Your memory (tape) runs ...
Loki Astari's user avatar
  • 97.7k

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