Open SergiyKolesnikov opened 7 years ago
The problem is in exprnodemodule.c
:
static const char *ASTOPS[] = {
"const",
"lit",
"or",
"and",
"xor",
"eq",
"not",
"impl",
"ite",
};
The to_ast
method is calling some C code that is incorrectly declaring both variables and complements to both be literals.
Also this bit:
def ast2expr(ast):
"""Convert an abstract syntax tree to an Expression."""
if ast[0] == 'const':
return _CONSTS[ast[1]]
elif ast[0] == 'var':
return exprvar(ast[1], ast[2])
else:
xs = [ast2expr(x) for x in ast[1:]]
return ASTOPS[ast[0]](*xs, simplify=False)
The comparison to 'var'
isn't right; it looks like it should be comparing to 'lit'
.
Also there's the minor problem that the C variable type doesn't have a name, but the Python variable type does. Hrm, deeper and deeper.
pyeda 0.28.0
ast2expr() throws the TypeError:
Test:
Output: