Symbolic Execution in Lisp-like languages

65 views
Skip to first unread message

Robert Feldt

unread,
Apr 15, 2008, 9:01:43 AM4/15/08
to Clojure
I want to do symbolic execution of code. When I have previously done
so in dynamic, OO languages like Ruby and Smalltalk I find it fairly
easy with some kind of proxy/wrapping technique. Instead of sending in
the actual arguments I wrap them in an object that collects the method
calls it takes part in etc. This way one can both execute the code as
normal while collecting symbolic execution information.

After starting more heavily on Clojure programming this is one of the
few things that I do not feel comes naturally. My one idea so far has
been to use multi-methods to dispatch to an alternative implementation
of a function that logs its execution etc before calling the original
function of the same name. However, it feels backwards. Maybe I should
just implement a Clojure evaluator that traces the execution while
evaluating expressions and use it instead of Clojures normal one.

If you have any ideas or pointers to techniques for symbolic execution
in Lisp-like languages I'd appreciate them. Currently it bugs me that
this is something that seems more involved in Clojure than in my
recent/previous languages.

Thanks,

Robert

Rich Hickey

unread,
Apr 16, 2008, 7:55:16 PM4/16/08
to Clojure
I'm not familiar with using the term symbolic execution for what you
are doing - is the purpose just for logging/profiling/tracing?

It's pretty straightforward to swap out fns with wrapped versions for
tracing - no need for multimethods. You can even do that in particular
contexts by rebinding the vars containing the functions. The example
at the bottom of this page shows how:

http://clojure.org/features/concurrent_programming.html

Rich
Reply all
Reply to author
Forward
0 new messages