Interpreter of Boolean Logic Language
Project description
Bamboolean interpreter
Supported from Python >= 3.6
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
Features
- Case in-sensitive variable names and keywords
- Comparison operators (listed below)
- Logic AND / OR / NOT
- Expressions with parentheses
- Types: Float, Int, String, Bool, Variable
- Truth value testing same as in Python
- Implicit cast of variables to boolean when no relational operator is specified
Operators associativity
All operators are left-associative
Operators precedence (the higher number the higher priority)
- OR
- AND
- NOT
- == | != | < | <= | > | >=
Testing
Run tests:
`python run_tests.py`
EBNF Grammar
compound_expr : expr
| empty
expr : simple_expr (OR simple_expr)*
simple_expr : term (AND term)*
term : statement
| LPAREN expr RPAREN
| NOT term
statement : value
| constraint
constraint : variable (relational_operator value)?
relational_operator : ( EQ | NE | LT | LTE | GT | GTE )
value : INTEGER
| FLOAT
| STRING
| BOOL
variable : ID
empty :
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bamboolean-0.4.0.tar.gz.
File metadata
- Download URL: bamboolean-0.4.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cc7ada7552438d6ec44ba4a90f38ade874b4606d09fe0a01f2240e9ead8cc62
|
|
| MD5 |
ffcb0fb4c44748617a1411ed38fb77c6
|
|
| BLAKE2b-256 |
aea20f616ab959518f1c3aca85c9935a26285faebf51445947872aa104411331
|
File details
Details for the file bamboolean-0.4.0-py3-none-any.whl.
File metadata
- Download URL: bamboolean-0.4.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2391cef13073dc66735bcd73d2444fab2c1f360292a829ddb054ecc5261994ed
|
|
| MD5 |
4011a9839af3b905eb6c328de93b2183
|
|
| BLAKE2b-256 |
88752a828fb17219261b8d5c132ba9f727ef3485056a963ae1b7876f2debf73f
|