Zomis / Brainduck

Brainfuck Interpreter in Java/Groovy, with a Groovy DSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hints, warnings, and errors

Zomis opened this issue · comments

Add a way for analysis to show hints, warnings and errors to the user

Errors include:

  • Infinite loops (halting problem is unsolvable, but try to detect some basic things)
  • Unbalanced brackets
  • Code does not produce expected output

Warnings include:

  • Each of the possible issues in Program Validation according to standards #12
  • Detect if any Brainfuck characters are used within comments, such as writing This program is awesome. which includes the BF command .
  • Input unused. When you feed more input to the BF program than the program reads.

Hints include:

  • +>+++<++>--<->+> performs change [2 2] and can be written as ++>++>
  • While loop always performed X times, consider expanding it (only show this if it would save characters + performance)
  • Memory cell(s) unused
  • Dead code

Many of these things are already available through some analysis, they just need to be converted to some kind of hint/warning/error object.

Related:

  • Code Analysis and optimization #4
  • Prevent hanging on infinite loops #8
  • Make it easier to test code for different inputs #26
  • Program Validation according to standards #12
  • Refactor Analysis to make it a composition #22 (also contains links to how Rubberduck handles code inspections)

Use red, orange, and blue background colors in code for errors, warnings, hints respectively.