Pyeda: infix form of boolean expression

346 Views Asked by At

Pyeda permits to write boolean expression in prefix form and in infix form:

p = Or(And("A","B"), And("C","D")) # prefix
i = expr("A & B | C & D") # infix

Although it's possible to retrieve automatically from i the relative prefix form, I don't know (no findings in docs) if it's possible to retrieve the string infix representation of p .

Some helps?

1

There are 1 best solutions below

3
Chris Drake On BEST ANSWER

PyEDA author here.

The latest release doesn't have this feature. If you go back to version 0.26.0, you can try the to_latex and to_unicode methods.

For example:

>>> p = Or(And("A","B"), And("C","D"))
>>> p.to_unicode()
'A · B + C · D'

IIRC, the reason for this omission was the switch from Python to C for the boolean expression engine. A couple undocumented features just got left out b/c it was either difficult, or broken.

PRs welcome, of course :)