Skip to content

vpowell4/sesl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESL — Expert System Language A forward-chaining rule engine with optional truth maintenance. ESL is a domain-specific language and runtime for writing expert system rules, inference logic, and structured decision models. It allows you to encode knowledge such as: tax logic legal rules operational compliance medical decision logic configuration / eligibility rules ESL supports: ✔ Forward chaining inference ✔ Prioritised rule firing ✔ let bindings ✔ Alpha-memory caching ✔ Optional TMS (truth maintenance) ✔ Natural YAML-like syntax 🔧 Installation Install from local checkout: pip install -e . OR build a wheel: python -m build pip install dist/esl-*.whl This installs the esl command-line tool. 🚀 Usage Run an ESL file: esl myrules.esl Enable rule trace: esl myrules.esl --trace Disable truth maintenance: esl myrules.esl --no-tms Increase iteration limit: esl myrules.esl --max-iter 50 📄 ESL File Structure An ESL file is YAML containing rules and (optional) facts: rules: - rule: Example if: supply.type == "service" then: result.flag: "SERVICE" facts: - name: "Scenario 1" supply: id: S1 type: service category: digital value: 100 supplier: country: UK vat_registered: true customer: type: business country: UK vat_registered: true 🧠 Features Forward-chaining evaluation Rules are evaluated in descending priority order until no new facts appear. Alpha-memory caching Repeated conditions are cached automatically. let bindings Pre-compute conditions for reuse: let: is_uk: supplier.country == "UK" Truth Maintenance (TMS) When a rule stops matching, ESL can retract its conclusions. Disable: esl file.esl --no-tms ✔ Example examples/simple.esl: rules: - rule: FlagDigital if: supply.category in ["digital"] then: result.is_digital: true facts: - name: Test supply: id: S1 category: digital type: service value: 100 supplier: country: UK vat_registered: true customer: type: consumer country: FR vat_registered: false Run: esl simple.esl --trace 📦 Packaging & Distribution To publish on PyPI: Update version in pyproject.toml Build: python -m build Upload: twine upload dist/* Users can then: pip install esl LICENSE MIT or Apache 2 recommended.# sesl # sesl

About

sesl - Simple Expert System Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages