drym-org / symex.el

An intuitive way to edit Lisp symbolic expressions ("symexes") structurally in Emacs
Other
271 stars 22 forks source link

Support transformations in the DSL #110

Open countvajhula opened 1 year ago

countvajhula commented 1 year ago

Currently, the Symex DSL only has support for motions. We can perform transformations as side effects in traversals (via e.g. symex--do-while-traversing) but these side effects are performed at every step of the traversal and cannot be made more fine-grained. We'd like to perform operations in a traversal program at arbitrary points in the traversal.

This will likely involve adding a small set of core transformation primitives to the DSL -- like delete and paste -- where the implementation of these primitives themselves would be done for Lisp and Tree-Sitter separately. In addition, we will likely need to fine tune the contract between the DSL layer and the primitives layer to keep each operation contained and tractable.

The advantage of expressing transformations in the DSL is that, with only a few primitives, it could be possible to implement a large number of features, allowing us to reuse work across Lisp and Tree Sitter languages without requiring custom implementations for every new feature. And also, the ability to express the algorithm using a high level DSL (i.e. Symex rather than Lisp) would make writing such features more accessible to users and library authors.