To use Symex with Tree-sitter, just ensure that you’re using the Tree-sitter enabled major mode for your language. For example, for Python, you must use ‘python-ts-mode’ rather than ‘python-mode‘.
Of course, this assumes that you already have Tree-sitter set up! If not, and if you’d like to use Symex with a non-Lisp language, you will need to do three things:
The first is self-explanatory. For the grammar, first find a Tree-sitter grammar for your language and then install it. You can find helpful instructions for this on Mastering Emacs. Finally, for the major mode, Emacs already includes such modes for some popular languages such as Python, but if your favorite language isn’t included, you may also find the Tree-sitter major mode for it on standard Emacs package archives like MELPA. These typically have the suffix -ts-mode
in their name, for instance, python-ts-mode
. Once installed, you will need to enable this major mode in your (e.g., Python) buffer, instead of the usual major mode (e.g., use python-ts-mode
instead of python-mode
).
And if you’ve done all that, you should now be able to use Symex with your language!
If you feel that support for your favorite language could be improved, we want to hear from you! Please submit an issue and let’s discuss your ideas.