7.1 Usage

The main entry point to Symex from ELisp is the symex-traversal form, which can also be used via the definition form, symex-deftraversal. These forms allow you to define traversals (e.g., movements or transformations of code) using the Symex language, and they are analogous to lambda and defun (for defining functions in ELisp), respectively. Traversals defined this way may be evaluated using symex-eval and would execute in relation to the selected expression. Symex considers point (i.e., the cursor) to indicate the start of the selected expression.

Here is what performing a very basic traversal looks like. You could try it, if you like, by placing point at the start of any symex, and then evaluating this code using M-:.

(symex-eval
  (symex-traversal
    (do (move up)
        (move forward))))

We’ll soon learn more about what this code means.