Skip to content

joelcancela/S5_SP_BrainFuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BrainFuck (Mül93) interpreter

What is this ?

This is an interpreter for the BrainFuck language (Mül93). It can read textual files (*.bf) and bitmaps (*.bmp).

Features

  • Can interpret a BrainFuck textual file (*.bf) or a bitmap (*.bmp) using -p argument.

  • Supports all default BrainFuck instructions in both short and long syntaxes :

    • + | INCR
    • - | DECR
    • < | LEFT
    • > | RIGHT
    • . | OUT, use the argument -o to specify an output file
    • , | IN, use the argument -i to specify an input file
    • [ | JUMP
    • ] | BACK

    More details here

  • Can rewrite a long syntax-written program into a short syntax written-program using --rewrite.
    The results are printed on stdout.

  • Can translate a textual program into an image-based one using --translate.
    The results are printed on stdout, you can redirect with > in command line to a bmp file to create the picture.

  • Can check if a program is well-formed (loops well formed and no wrong instructions) using --check.
    The results are printed on stdout.

  • Show metrics for an execution of a program (shown in stdout, after the program results), more details here.

  • Logging step to trace execution using --trace, creates a .log file where the program is to help the debug.

  • Supports the code comments & indentation, you can use # (like in shell) to create your comments, tabulations, space and line breaks are supported.

  • Supports macros, more details here.

  • Supports functions & procedures, more details here.

  • Can generate C code from any program using --cgen, creates a .c file in the program directory.

Requirements

Maven and the JDK 8 are required to build the project.

How to launch

UNIX Systems

./bfck

WINDOWS

mvn install
mvn -q exec:java -Dexec.mainClass="Main" -Dexec.args="[args]"


TODO/Known Bugs

  • Launching a program containing the instruction IN with --trace causes the execution to infinite loop
  • Next to a procedure/function declaration (not call), having parenthesis in comment causes the execution to fail
  • In a procedure/function, parameters can't be used inside a loop

Done

Week 50-01

  • End level 4 (S18->S21)
  • Tweaks

Week 46-49

  • Oral presentation 3
  • End level 3 (S12->S17)
  • Rapport level 3
  • Keep calm and step back (L3)

Week 41-45

  • Oral presentation 2
  • End level 2
  • Rapport level 2
  • Keep calm and step back (L2)
  • Adapt the main to be able to handle every flags

Week 39-40

  • Start Level 2, do s5 and s6
  • Do the "Take a step back" review + justify all your choices
  • Do some scheduling

Week 37-38

  • Learn to use Git
  • Decide and create the structure of the project on a separate branch
  • Read the entire pdf, and understand it.
  • Finish first slice s0 with Javadoc associated
  • Finish s1, s2, s3, s4 with exception handling and Javadoc associated
  • Unit tests