Ejemplo n.º 1
0
 def p_directive_assume(self, k, n, e):
     # Fun fact.  This manipulation (and the similar treatment of
     # observe and predict, here and in the VentureScript parser)
     # breaks an invariant that parsing used to satisfy.  To wit,
     # once upon a time it was the case that the string picked out
     # by the location tags of every node in a parse tree was
     # guaranteed to re-parse to an equal node.  This cannot be the
     # case now, because the 'expr' node constructed here is not
     # parsed from the string, but synthesized based on knowing
     # that its constituents appear in an 'assume' directive.
     expr = [
         ast.update_value(k, val.symbol('assume')),
         ast.map_value(val.symbol, n), e
     ]
     return expression_evaluation_instruction(ast.loclist(expr))
Ejemplo n.º 2
0
 def p_path_expression_one(self, slash, s):
     assert ast.isloc(s)
     top = ast.update_value(slash, val.symbol('by_top'))
     intersect = ast.update_value(slash, val.symbol('by_walk'))
     app = [intersect, ast.loclist([top]), s]
     return ast.locmerge(top, s, app)
Ejemplo n.º 3
0
 def p_directive_predict(self, k, e):
     expr = [ast.update_value(k, val.symbol('predict')), e]
     return expression_evaluation_instruction(ast.loclist(expr))
Ejemplo n.º 4
0
 def p_directive_observe(self, k, e, e1):
     expr = [ast.update_value(k, val.symbol('observe')), e, e1]
     return expression_evaluation_instruction(ast.loclist(expr))
Ejemplo n.º 5
0
 def p_directive_assume_values(self, k, nl, e):
     expr = [ast.update_value(k, val.symbol('assume_values')), nl, e]
     return expression_evaluation_instruction(ast.loclist(expr))