jSIMLIB检查程序打印出基本上是lisp代码的s表达式代码
(set-option :print-success false)
(set-logic QF_LIA)
(declare-fun RETURN () Int)
(declare-fun refs_1_SYMINT () Int)
(declare-fun flags_2_SYMINT () Int)
(assert+ ( and ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 100)) ) ) ( not ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 10)) ) ) ) ) )
(check)
(exit)
如何格式化代码,最好使用emacs或TextMate?例如:
(set-option :print-success false)
(set-logic QF_LIA)
(declare-fun RETURN () Int)
(declare-fun refs_1_SYMINT () Int)
(declare-fun flags_2_SYMINT () Int)
(assert
(and
(and
(and
(distinct flags_2_SYMINT 0)
(= RETURN flags_2_SYMINT))
(= refs_1_SYMINT refs1_1_SYMINT)
(= flags_2_SYMINT flags1_2_SYMINT))
(not
(and
(distinct flags_2_SYMINT 0)
(= RETURN flags_2_SYMINT)))))
(check-sat)
答案 0 :(得分:9)
pp
函数可以很好地打印出来,但可能与您想要的格式不完全匹配。
以下是您问题中的一行:
(pp '(assert+ ( and ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 100)) ) ) ( not ( or ( and (/= flags_2_SYMINT 0) (and (= RETURN flags_2_SYMINT)) ) ( and (/= refs_1_SYMINT 0) (and (= flags_2_SYMINT 0)) (and (= RETURN refs_1_SYMINT)) ) ( and (and (= refs_1_SYMINT 0)) (and (= flags_2_SYMINT 0)) (and (= RETURN 10)) ) ) ) ) ))
输出是:
(assert+
(and
(or
(and
(/= flags_2_SYMINT 0)
(and
(= RETURN flags_2_SYMINT)))
(and
(/= refs_1_SYMINT 0)
(and
(= flags_2_SYMINT 0))
(and
(= RETURN refs_1_SYMINT)))
(and
(and
(= refs_1_SYMINT 0))
(and
(= flags_2_SYMINT 0))
(and
(= RETURN 100))))
(not
(or
(and
(/= flags_2_SYMINT 0)
(and
(= RETURN flags_2_SYMINT)))
(and
(/= refs_1_SYMINT 0)
(and
(= flags_2_SYMINT 0))
(and
(= RETURN refs_1_SYMINT)))
(and
(and
(= refs_1_SYMINT 0))
(and
(= flags_2_SYMINT 0))
(and
(= RETURN 10)))))))
答案 1 :(得分:6)
在GNU Emacs中,您可以使用indent-pp-sexp
。
将s-expression之前的光标设置为漂亮打印并输入c-u m-x indent-pp-sexp
。