Coder Social home page Coder Social logo

brainfuck's Issues

Support piped input

It would be nice if piped content was supported:

echo '.+[.+] prints out all ASCII characters' | brainfuck -c
# Other example: concatenate two brainfuck programs and execute them
cat file1 file2 | brainfuck -c
# Other example: minify brainfuck code using brnfckr and pass the result to `brainfuck` directly
brnfckr '.+[.+] prints out all ASCII characters' | brainfuck -c

Currently, this gives the following error:

error: no code specified!

error on make; editline/readline.h: no such file or directory

Hello. When I try to make the program, an error shows that editline/readline/h does not exist.

[ 40%] Built target libbrainfuck_static [ 60%] Building C object CMakeFiles/brainfuck.dir/src/main.c.o /media/sebastian/UUI/sml/Coding/BF/brainfuck/src/main.c:24:11: fatal error: editline/readline.h: No such file or directory #include <editline/readline.h> ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. CMakeFiles/brainfuck.dir/build.make:62: recipe for target 'CMakeFiles/brainfuck.dir/src/main.c.o' failed make[2]: *** [CMakeFiles/brainfuck.dir/src/main.c.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/brainfuck.dir/all' failed make[1]: *** [CMakeFiles/brainfuck.dir/all] Error 2

I have libedit in a directory in my home directory, and I have the dependencies required for that as well. Am I doing something wrong?

Bad Merge

Code is currently not compilable due to debris left behind by diff3(1)

For example:

 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef BRAINFUCK_H
#define BRAINFUCK_H

<<<<<<< HEAD
#define BRAINFUCK_VERSION "2.3"
=======
#define BRAINFUCK_VERSION "2.4"
>>>>>>> f3fdf57cc86182aacc89de87f2d5f7827dbf6d0f
#define BRAINFUCK_CELL_TYPE int
#define BRAINFUCK_TAPE_SIZE 30000

#define BRAINFUCK_TOKEN_PLUS '+'
#define BRAINFUCK_TOKEN_MINUS '-'
#define BRAINFUCK_TOKEN_PREVIOUS '<'
#define BRAINFUCK_TOKEN_NEXT '>'
#define BRAINFUCK_TOKEN_OUTPUT '.'

Cmake error when trying to build

This is the error message I get:
~/Github/brainfuck/build$
cmake ..
CMake Error at /home/.../.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find editline (missing: EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
Call Stack (most recent call first):
/home/stefggl/.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/Findeditline.cmake:31 (find_package_handle_standard_args)
CMakeLists.txt:52 (find_package)

-- Configuring incomplete, errors occurred!

cmake is version 3.26.4
Ubuntu 22.04 machine

Interpreter always ignores first character of brainfuck

Regardless of whether you are running a program from file or using direct input, the first character is always ignored. i.e. The ASCII value for '!' is 32, so theoretically the following program should output the character '!'
++++++++++++++++++++++++++++++++.
But instead outputs the character with the ASCII value of 31, even though '+' is written 32 times. Adding an extra '+' prints out an '!', but this is incorrect behaviour.

Does not build with clang

make all CC=cc CCFLAGS=
Building
mkdir -p bin
cc  -o /private/tmp/brainfuck-9gd5/brainfuck-0.1.2/bin/brainfuck /private/tmp/brainfuck-9gd5/brainfuck-0.1.2/src/*
clang: error: cannot specify -o when generating multiple output files
make: *** [all] Error 1

See: Homebrew/legacy-homebrew#19542

Remove hard dependency on libedit

The project now requires the libedit library to be installed in order to build the command line interface.

We should have a build option to disable the interactive console, so people can build the command line interface without needing the libedit library if they are not interested in the interactive console.

Failed at cmake ..

Faced this issue while installing brainfuck in ubuntu x86_64 at this step

cmake ..

Output :

Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
CMake Error at CMakeLists.txt:29 (message):
  Doxygen is needed to build the documentation.

Allow for direct input

Currently, there’s brainfuck [file] for files, and brainfuck -i for interactive mode.

How about adding -c | --code which take direct input as strings?

E.g.

$ brainfuck -c '.+[.+]'

I get a fatal error when I try to run 'make'

I get the following error message:

[ 33%] Built target brainfuck
Scanning dependencies of target brainfuck-cli
make[2]: Warning: File 'CMakeFiles/brainfuck-cli.dir/depend.make' has modification time 0.77 s in the future
[ 50%] Building C object CMakeFiles/brainfuck-cli.dir/src/main.c.o
/mnt/c/GitRepos/brainfuck/src/main.c:23: warning: "BRAINFUCK_EDITLINE_LIB" redefined
   23 |  #define BRAINFUCK_EDITLINE_LIB
      |
<command-line>: note: this is the location of the previous definition
/mnt/c/GitRepos/brainfuck/src/main.c:24:11: fatal error: editline/readline.h: No such file or directory
   24 |  #include <editline/readline.h>
      |           ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/brainfuck-cli.dir/build.make:63: CMakeFiles/brainfuck-cli.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: CMakeFiles/brainfuck-cli.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I am following the readme guide. And I get the error both in on MinGW on windows and in WSL.
If I'm the one doing something wrong, then please tell me what.

Thanks in advance.

Unexpected "error: tape memory out of bounds (overrun)"

I've run into some issue when playing with bf using this interpreter. Below is the simplest test case I was able to make, that show the problem:

>
><<
$ echo ">\n><<" | brainfuck
error: tape memory out of bounds (overrun)
exceeded the tape size of 30000 cells
$ echo $?
1

If we add single space between > and < then problem disappears:

>
> <<
$ echo ">\n> <<" | brainfuck
$ echo $?
0

Please provide a way to stop execution via the API

The API currently includes the function brainfuck_execute, but there is no way to stop the execution. This means that code that includes infinite loops will execute forever. Worse, if this API is used in code (i.e in a tool that interprets BF) this provides a plethora of opportunities for your application to crash.

Have a look at this

This is not an issue.
I admire this project quite much, but please excuse me if I advertise my project here.
A visual brainfuck interpreter online:
Github Page: web page
Github Repo: v-bf-web

Add automated test support

This issue is concerned with adding support for automated testing. Test automation provides the benefit of automatically checking for breaking changes when adding features or refactoring parts of the code. In addition, we can also add automated tests for parts of the code that are often forgotten when running manual tests.

I propose we use the builtin testing functionality of CMake - CTest - to drive our tests.

Needs license

Hey, wanting to use this for a project, could you throw a license in the repo? :)

Thanks

Readme command-line options inconsistent

The readme for this project shows the usage guidelines ...

Usage

brainfuck [-ch] <filenames>
-e  run code directly
-h  show a help message.

... but is unclear as to whether -c or -e is actually the option for running code directly. This could be figured out really quickly by running the program, but I think it'd be beneficial from making the command-line options more unambiguous.

Add support for automatic packaging and releases

This issue is concerned with adding support for automatic packaging of the interpreter for various operating systems/distributions.

  • Create Release action that publishes artifacts in a Github Release
  • Explore packaging options via CPack

Add Continuous Integration

We should be able to build on some Travis machines to check whether the master still builds before merging a pull request.

libedit/history.h include error

So , I got the interpreter working but just letting you know about this bug.

my software specs:

 OS: Arch Linux
 KDE Plasma Version: 5.10.5
 KDE Frameworks Version: 5.37.0
 Qt Version: 5.9.1
 Kernel Version: 4.12.8-2-ARCH
 OS Type: 64-bit
 ------------------------------------------------------------
  COMPILER
 ------------------------------------------------------------
 gcc (GCC) 7.1.1 20170630
 Copyright (C) 2017 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 --------------
  LIBEDIT
 --------------

 libedit 20170329_3.1-1 [installed]

When I compiled it shot with a include error ,

fatal error: editline/history.h: No such file or directory
   #include <editline/history.h>
            ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/brainfuck.dir/build.make:63: CMakeFiles/brainfuck.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/brainfuck.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

So what I did was comment this line in src/main.c

#ifdef BRAINFUCK_EDITLINE_LIB
        #include <editline/readline.h>
/*      
 * This line caused the compile error , even if it is not mac
 * I think , We don't need to include editline/history.h when
 * We already included editline/readline.h
        #ifndef __APPLE__ 
                #include <editline/history.h>  
        #endif
*/
#endif

After editing this , I compiled successfully!

is this intensional?......
just reporting!

Support for Windows ? And other things...

Is Windows supported ? Can you create a compiler fonctionality with this command scheme : brainfuck <INPUT_FILE_PATH> -o <OUTPUT_FILE_PATH> ? And can you create a distribuable installer in .exe for Windows (if Windows is supported), .deb/.rpm for Linux and .dmg for macOS ?

Build fails due to editline

[ 33%] Built target brainfuck
[ 50%] Building C object CMakeFiles/brainfuck-cli.dir/src/main.c.o
/home/romario/super-ia-project/bfinterpreter2/src/main.c:23:11: fatal error: editline/readline.h: No such file or directory
#include <editline/readline.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/brainfuck-cli.dir/build.make:62: recipe for target 'CMakeFiles/brainfuck-cli.dir/src/main.c.o' failed
make[2]: *** [CMakeFiles/brainfuck-cli.dir/src/main.c.o] Error 1
CMakeFiles/Makefile2:904: recipe for target 'CMakeFiles/brainfuck-cli.dir/all' failed
make[1]: *** [CMakeFiles/brainfuck-cli.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Espace sequences instead of cursor movement

I'm not sure if this intentional but the interpreter disallows basically any sort of cursor movement, like that with the arrow keys or emacs-like Ctrl-e/Ctrl-a type of stuff. When I try to to for example move my cursor to the right some escape sequence appears on the prompt instead. Any fix on my side or a rationale behind the choice to disable cursor movement ? (macOS 10.12 + iTerm)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.