-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcb_predicate_sm.py
More file actions
48 lines (26 loc) · 857 Bytes
/
Copy pathpcb_predicate_sm.py
File metadata and controls
48 lines (26 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import asp.tree_grammar
import ast
import types
asp.tree_grammar.parse('''
UnaryPredicate(input=Identifier, body=BoolExpr)
BinaryPredicate(inputs=Identifier*, body=BoolExpr)
check assert len(self.inputs)==2
Expr = Constant
| Identifier
| BinaryOp
| BoolExpr
Identifier(name=types.StringType)
BoolExpr = BoolConstant
| IfExp
| Attribute
| BoolReturn
| Compare
Compare(left=Expr, op=(ast.Eq | ast.NotEq | ast.Lt | ast.LtE | ast.Gt | ast.GtE), right=Expr)
Constant(value = types.IntType | types.FloatType)
BinaryOp(left=Expr, op=(ast.Add | ast.Sub), right=Expr)
BoolConstant(value = types.BooleanType)
IfExp(test=BoolExpr, body=BoolExpr, orelse=BoolExpr)
# this if for a.b
Attribute(value=Identifier, attr=Identifier)
BoolReturn(value = BoolExpr)
''', globals())