Giter VIP home page Giter VIP logo

bool's Introduction

bool

Build Status

This is a cross-platform library for parsing boolean arithmetic expressions like a && b && (!c || !d) and evaluating them by assigning values to the variables.

Boolean expressions are parsed into an abstract syntax tree (AST) using a lexer/parser generated by various Lex/Yacc clones for the various programming languages. This allows grammars to be fairly similar across languages.

Evaluation of the boolean expressions is done by traversing the AST with a visitor. (This is obviously overkill for something as simple as boolean expressions, keep reading to understand why).

Supported platforms are Ruby, JRuby, Java and JavaScript. More platforms like Python, PHP and .NET may be added later.

The Ruby gem uses a C extension (for speed) and the JRuby gem uses a Java extension (also for speed). Support for e.g. Python could be added easily by using the same C code as the Ruby gem. Java programs (or any other JVM-based program such as Scala or Clojure) can also use the Java library as-is.

Why?

The purpose of this library is twofold.

First, it serves as a simple example of how to build a custom interpreted language with a fast lexer/parser that builds a visitor-traversable AST, and that runs on many different platforms. People who want to build a bigger cross-platform language could leverage the structure and build files in this project. For example, the Gherkin 3.0 project will use this project as a template.

Second, this project will be used by Cucumber to evaluate tag expressions in a more elegant way.

Building

See DEVELOPERS.md

bool's People

Contributors

aslakhellesoy avatar mattwynne avatar ilanpillemer avatar os97673 avatar dkowis avatar orieken avatar kosmas avatar luislavena avatar paoloambrosio avatar sebrose avatar

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.