You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, Boolean functions support NOT ("!", "'"), AND ("&", "*", " "), OR ("|", "+"), and XOR ("^") operations as well as brackets ("(", ")") when being parsed from a string.
The following parses OK:
hal_py.BooleanFunction.from_string("(A & B) | C")
The following should parse according to the documentation, but doesn't:
hal_py.BooleanFunction.from_string("(A * B) + C")
The latter produces the following error:
[06.11.2024 19:50:24] [python_context] [error] [hal/src/python_bindings/bindings/boolean_function.cpp:1251] [hal/src/netlist/boolean_function.cpp:1079] could not parse Boolean function from string: no parser available for '(A...
Can we fix the parser, or update the docs?
The text was updated successfully, but these errors were encountered:
The reason seems to be that HAL switches to the Liberty parser when encountering the "*" or "+" symbols. While the HAL-internal parser has no issue with spaces, the Liberty parser treats spaces as AND. Thanks @fyrbiak for pointing this out.
Hence, what does work is the following:
hal_py.BooleanFunction.from_string("(A*B)+C")
I updated the documentation to include a caution about spaces in equations.
The wiki states:
The following parses OK:
The following should parse according to the documentation, but doesn't:
The latter produces the following error:
Can we fix the parser, or update the docs?
The text was updated successfully, but these errors were encountered: