Skip to main content

An implementation of S-FEEL using SLY (lex and yacc for Python3)

Project description

pySFeel

An implementation S-FEEL (Simple Expression Language) as specified in the DMN (Decision Model Notation) standard. pySFeel is implemented in Python, using the SLY module and has many FEEL features.

  • not, and and or in logical expressions which can be enclosed in round brackets (())
  • in() function, e.g. 5 in(<6)
  • Lists and filters
  • Contexts and filters
  • Ranges
  • Built in functions
  • New DMN 1.3 built in functions - is(), and the range comparison functions

pySFeel processes a single S-FEEL statement at a time. It is not intended to be a syntactically perfect implementation of S-FEEL, but rather an enabler for an implementation of DMN (Decision Model Notation) pyDMNrules. The internal data types are float, string, boolean, datetime.date, datetime.time, and datetime.timedelta. The S-FEEL constant null is mapped to None. Years and months durations are stored as floats. Days and time durations are stored as datetime.timedelta

There is one deliberate deviation from the standard - the key word 'item' in a Context filters is not optional. [{x:1,y:2},{x:2,y:3}][x=1] is not valid (as x=1 is either True or False), but [{x:1,y:2},{x:2,y:3}][item x=1] is valid and will return {x:1,y:2}. Similarly, fred.y is not the 'y' filter on the List of Contexts named 'fred' (as fred.y is a valid name). However (fred).y is the 'y' filter on the list of Contexts named fred.

There's one extension - an assignment operator (<-)

fred <- 7
bill <- 9
fred = bill

This will return False

fred <- [{x:1,y:2},{x:2,y:3}]
(fred).y

This will return [2,3]

USAGE:

import pySFeel
parser = pySFeel.SFeelParser()
sfeelText = '7.3 in [2.0 .. 9.1]'
(status, retVal) = parser.sFeelParse(sfeelText)
if 'errors' in status:
    print('With errors:', status['errors'])
  • retVal will be True
  • The dictonary 'status' will have the key 'errors' if you have errors in your sfeelText.
  • status['errors'] is a list of strings. It may help in diagnosing your S-FEEL syntax errors.

Documentation: More details can be found at readthedocs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pySFeel-1.3.8.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

pySFeel-1.3.8-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file pySFeel-1.3.8.tar.gz.

File metadata

  • Download URL: pySFeel-1.3.8.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.12

File hashes

Hashes for pySFeel-1.3.8.tar.gz
Algorithm Hash digest
SHA256 c55f6ce95e17bae4a75344ea7e1ee71211f6e9a8aa01541deb86db97fc6e2e4d
MD5 3e05b55918621c01a64a685fe0101186
BLAKE2b-256 4085d12af1e88f01dacec061ed35aaa08053447b7b4d1d4a9fdd336b5f1afa74

See more details on using hashes here.

File details

Details for the file pySFeel-1.3.8-py3-none-any.whl.

File metadata

  • Download URL: pySFeel-1.3.8-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.12

File hashes

Hashes for pySFeel-1.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b2f26ae19517abcb9e7d9ffb061c8f6a6b6b7f1d54a827a9922e2aae08019f62
MD5 f616794869cb64517f1589113bb7cc84
BLAKE2b-256 3a9b10372cc4a32db3f0bff7376e5dbc1f5caed84efe2fae27dfb9997eaae7d2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page