How-to guides#

Parsing and running program strings#

You can provide your program in a special DSL language. You can parse this with egglog.bindings.EGraph.parse_program() and then run the result with You can parse this with egglog.bindings.EGraph.run_program()::

from egglog.bindings import EGraph

egraph = EGraph()
commands = egraph.parse_program("(check (= (+ 1 2) 3))")
commands
[Check([Eq([Call('+', [Lit(Int(1)), Lit(Int(2))]), Lit(Int(3))])])]
egraph.run_program(*commands)
[]

Developing this package#

To get started developing on this package:

  1. Create a Python environment to develop on, either with virtualenv or conda.

  2. Install this package in editable mode: pip install -e .[dev,test]

  3. Run the tests: pytest

  4. Run the pre-commit hooks: pre-commit run --all-files