Giter VIP home page Giter VIP logo

cattle's Introduction

Cattle - Brainfuck language toolkit

Cattle is a GObject-based library that allows one to inspect Brainfuck programs in various ways, and to easily embed a full-featured Brainfuck interpreter into any application.

Features

Cattle is able to load and execute virtually any Brainfuck program; both the code loader and the interpreter have good error checking, and are able to catch common coding errors such as unbalanced brackets.

Interpreters support flexible I/O using callbacks, which means it is possible to load a program's input from any source and send its output to any source. Examples include loading the program's input from a GTK+ widget and sending its output to a network socket.

The behaviour of an interpreter can be further customized, for example by enabling or disabling the runtime debugging support.

While program execution is a very important aspect of Cattle, it is possible to process a loaded programs in many ways, including adding or removing instructions.

Development status

The library currently provides enough features to implement a working interpreter in about 70 lines of code (see examples/run.c); the API is stable and considered good enough for production use.

Limitations

The main limitation of Cattle lies in its performances: while it performs better than many interpreters written in a high-level programming language and than most naive interpreters written in C, it is easily outperformed by any optimized interpreter written in C.

The reason is mainly the overhead imposed by the GObject type system; while it would certainly be possible to dump GObject, I feel the features it provides are worth the performance hit.

Resources

The project's website contains pointers to the canonical Git repository, which you should clone if you're interested in hacking on Cattle, and the official release archives, which you should use otherwise.

Several distributions provide packages for Cattle: if your distribution is among those, you should use your package manager to install Cattle instead of building from source.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

cattle's People

Contributors

andreabolognani avatar bfontaine avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jehoctor

cattle's Issues

Missing configure script

Hello,

There's no configure script at the root of your project, so we can't install it with the usual commands:

./configure
make
make install

The script should not be ignored by git.

1.2.0 Fails to Compile with Clang

Build fails consistently with Clang. OS X 10.10.2, Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn).

Clang build:

==> make install
Making install in cattle
  GEN      cattle-enums.h
  GEN      cattle-enums.c
/Applications/Xcode.app/Contents/Developer/usr/bin/make  install-am
  CC       cattle-version.lo
  CC       cattle-constants.lo
  CC       cattle-error.lo
  CC       cattle-buffer.lo
cattle-buffer.c:241:2: error: non-void function 'cattle_buffer_get_value' should return a value [-Wreturn-type]
        g_return_if_fail (CATTLE_IS_BUFFER (self));
        ^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/glib/gmessages.h:373:3: note: expanded from macro 'g_return_if_fail'
         return;                                                        \
         ^
cattle-buffer.c:244:2: error: non-void function 'cattle_buffer_get_value' should return a value [-Wreturn-type]
        g_return_if_fail (!priv->disposed);
        ^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/glib/gmessages.h:373:3: note: expanded from macro 'g_return_if_fail'
         return;                                                        \
         ^
cattle-buffer.c:245:2: error: non-void function 'cattle_buffer_get_value' should return a value [-Wreturn-type]
        g_return_if_fail (position < priv->size);
        ^
/usr/local/Cellar/glib/2.42.1/include/glib-2.0/glib/gmessages.h:373:3: note: expanded from macro 'g_return_if_fail'
         return;                                                        \
         ^
3 errors generated.
make[2]: *** [cattle-buffer.lo] Error 1
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1

Build works fine with Gcc 4.9.2.

archive tarball build failure due to missing ChangeLog

Full build log: https://gist.github.com/ilovezfs/4898eac0e41c7dbab7b2f6c728c80ee8

The error is

/usr/bin/install -c -m 644 AUTHORS.markdown ./ChangeLog ChangeLog.pre-0.9.2 COPYING NEWS.markdown README.markdown TODO.markdown '/usr/local/Cellar/cattle/1.2.1/share/doc/cattle-1.0'
install: ./ChangeLog: No such file or directory
make[2]: *** [install-dist_docDATA] Error 71
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1

Building from the tag itself checkout from a clone of the git repository succeeds.

The cause seems to be

    if test -d "./.git"; \
    then \
      GIT_DIR="./.git" \
      ./missing \
        --run git log --color=never --stat \
      >ChangeLog.tmp \
      && mv -f ChangeLog.tmp ChangeLog \
      || ( rm -f -f ChangeLog.tmp; false ) \
    fi

doesn't run because there is no .git directory in the GitHub source archive tarball.

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.