def __repr__(self): if run_mode() is interactive: code = interactive_parser().parse(self) code = interactive_tagger().tag_loop_label(code) code = to_sexpression(code) result = interactive_solver().eval(code) return repr(result) if result is not None else '' else: return self.____repr____()
def __init__(self, name, grammar): self.__form_name__ = name if grammar is None: self.__form_grammar__ = None else: #print grammar self.__form_grammar__ = to_sexpression(preparse(or_p(grammar, syntax_error))) self.__operator_data__ = []
def __repr__(self): if run_mode() is interactive: code = interactive_parser().parse(self) code = interactive_tagger().tag_loop_label(code) code = to_sexpression(code) result = interactive_solver().eval(code) return repr(result) if result is not None else '' return '%s(%s)'%(self.operator, ','.join([repr(e) for e in self.operand]))
def __repr__(self): if run_mode() is interactive: code = interactive_parser().parse(self) code = interactive_tagger().tag_loop_label(code) code = to_sexpression(code) result = interactive_solver().eval(code) return repr(result) if result is not None else '' x = _operator_repr(self.operand[0], self.operator) y = _operator_repr(self.operand[1], self.operator) return '%s%s%s'%(x, self.operator.symbol, y)
def solve(exp): code = interactive_parser().parse(exp) code = interactive_tagger().tag_loop_label(code) code = to_sexpression(code) return interactive_solver().solve(code)
def to_sexpression(self): return (set_list, self.vars, to_sexpression(self.exp))
def to_sexpression(self): return (catch, to_sexpression(self.tag)) +to_sexpression(self.body)
def to_sexpression(self): return (block, self.label)+to_sexpression(self.body)
def to_sexpression(self): return (set, self.var, to_sexpression(self.exp))
def to_sexpression(self): return (self.__class__, self.vars)+to_sexpression(self.body)
def to_sexpression(self): return (OnForm,)+to_sexpression(self.form, self.body, self.var)
def preparse_to_sexpression(exp): return to_sexpression(preparse(exp))
def to_sexpression(self): return (to_sexpression(self.operator),)+tuple(to_sexpression(x) for x in self.operand)
def to_sexpression(self): return (quote, to_sexpression(self.exp))
def to_sexpression(self): cases = dict((k, to_sexpression(tuple(v))) for k, v in self.cases.items()) return (CaseForm,)+to_sexpression((self.test, cases, self.els))
def eval(exp): exp = preparse(exp) sexp = to_sexpression(exp) return make_solver().eval(sexp)
def to_sexpression(self): self.bindings = to_sexpression(self.bindings) self.body = to_sexpression(self.body) return (self.__class__, self.bindings)+self.body
def to_sexpression(self): return (self.__class__,)+to_sexpression(self.rules)
def to_sexpression(self): return (set_global, self.var, to_sexpression(self.exp))
def to_sexpression(self): return (module, )+to_sexpression(self.body)
def to_sexpression(self): return (begin, )+to_sexpression(self.exps)
def to_sexpression(self): return (exit_block,)+to_sexpression((self.label, self.form))
def to_sexpression(self): return (if_, )+to_sexpression((self.test, self.exp1, self.exp2))
def to_sexpression(self): return (throw,)+to_sexpression((self.tag, self.form))
def to_sexpression(self): return (iff, to_sexpression(self.clauses), to_sexpression(self.els))
def to_sexpression(self): return (unwind_protect, to_sexpression(self.form))+to_sexpression(self.cleanup)
def to_sexpression(self): return (pytry,)+to_sexpression((self.body, self.exception, self.ex_clause, self.final))