2017-02-06

I wrote this brainfuck interpreter in C++ using interpreter and composite patterns. I would like to make this code more scalable.

Indeed, if we need to add a extra command, we'll have to add a new class derived from AbstractExpression but we may also need to modify some initialization in the constructor CompositeExpression(string code).

Is it possible to get something more polymorphic without adding a lot of classes?

Besides, is it a good practice to use a recursive call in the constructor CompositeExpression(string code)?

Includes and using namespace

Structure handled by Brainfuck commands

Abstract class of an expression

Classes of terminal expression

Class of non terminal expression (loop)

Hello world !

Show more