Skip to main content

Bamboolean interpreter

Build Status

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)
  1. OR
  2. AND
  3. NOT
  4. == | != | < | <= | > | >=

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 :

Metadata

Release files for bamboolean 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bamboolean 0.4.0
File Size Uploaded
bamboolean-0.4.0.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bamboolean 0.4.0
File Interpreter ABI Platform
bamboolean-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / bamboolean-0.4.0.tar.gz

Download URL bamboolean-0.4.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6cc7ada7552438d6ec44ba4a90f38ade874b4606d09fe0a01f2240e9ead8cc62
BLAKE2b-256 checksum
How to use checksums
aea20f616ab959518f1c3aca85c9935a26285faebf51445947872aa104411331
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bamboolean-0.4.0-py3-none-any.whl

Download URL bamboolean-0.4.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2391cef13073dc66735bcd73d2444fab2c1f360292a829ddb054ecc5261994ed
BLAKE2b-256 checksum
How to use checksums
88752a828fb17219261b8d5c132ba9f727ef3485056a963ae1b7876f2debf73f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page