Interpreter of Boolean Logic Language
Project description
# Bamboolean interpreter
[![Build Status](https://travis-ci.org/qedsoftware/bamboolean.svg?branch=master)](https://travis-ci.org/qedsoftware/bamboolean)
Supported from Python >= 3.4
Implementation of Bamboolean - Boolean Logic Language
Bamboolean is a simple language that consumes array of pre-defined variables, and
returns boolean value if constraints on these variables are met.
[Exemplary expressions in the language](./bamboolean/tests/fixtures.py)
## Features
- Case in-sensitive variable names and keywords
- Comparison operators
- Logic AND / OR
- Expressions with parentheses
- Types: Floats, ints and string
##### Operators associativity
All operators are lef-associative
##### Operators precedence (the higher number the higher priority)
1. OR
2. AND
3. == | != | < | <= | > | >=
## Testing
Run tests:
`python run_tests.py`
## BNF Grammar
```
expr : simple_expr (OR simple_expr)*
simple_expr : term (AND term)*
term : constraint
| LPAREN expr RPAREN
constraint : variable relational_operator value
value : INTEGER
| FLOAT
| STRING
| BOOL
variable: ID
relational_operator : ( EQ | NE | LT | LTE | GT | GTE )
```
[![Build Status](https://travis-ci.org/qedsoftware/bamboolean.svg?branch=master)](https://travis-ci.org/qedsoftware/bamboolean)
Supported from Python >= 3.4
Implementation of Bamboolean - Boolean Logic Language
Bamboolean is a simple language that consumes array of pre-defined variables, and
returns boolean value if constraints on these variables are met.
[Exemplary expressions in the language](./bamboolean/tests/fixtures.py)
## Features
- Case in-sensitive variable names and keywords
- Comparison operators
- Logic AND / OR
- Expressions with parentheses
- Types: Floats, ints and string
##### Operators associativity
All operators are lef-associative
##### Operators precedence (the higher number the higher priority)
1. OR
2. AND
3. == | != | < | <= | > | >=
## Testing
Run tests:
`python run_tests.py`
## BNF Grammar
```
expr : simple_expr (OR simple_expr)*
simple_expr : term (AND term)*
term : constraint
| LPAREN expr RPAREN
constraint : variable relational_operator value
value : INTEGER
| FLOAT
| STRING
| BOOL
variable: ID
relational_operator : ( EQ | NE | LT | LTE | GT | GTE )
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bamboolean-0.1.5.tar.gz
(8.4 kB
view hashes)
Built Distribution
bamboolean-0.1.5-py3-none-any.whl
(11.8 kB
view hashes)
Close
Hashes for bamboolean-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f27742952a9523663812c9388c868466be7678cf4e54cbc0329670e69095bba5 |
|
MD5 | cc9cbf978f95aaa39574be86efedd9f6 |
|
BLAKE2b-256 | 61d64ee48c1fea6ace4efbed8ce572b5cb7da4464fc6d7d20b53df6294a8bf2f |