[[!meta title="Tree-edit: Structural editing for Java, Python, C, and beyond"]] [[!meta copyright="Copyright © 2021 Ethan Leba"]] [[!inline pages="internal(2021/info/structural-nav)" raw="yes"]] # Tree-edit: Structural editing for Java, Python, C, and beyond! Ethan Leba In this talk, I'll discuss a vision for how writing code could be, where the editing operations map directly to the primitives of the language itself -- and my humble attempt of implementing this vision. _tree-edit_ seeks to provides a structural editing plugin supporting conceivably any language with a tree-sitter parser. **Structural editing does not have to be relegated to lisps or niche DSLs.** I liken the state of code editing today to writing assembly. The reason why people like Python more than assembly is that for most purposes, the building blocks of the language are mismatched with our thought process. We don't think in terms of registers and addresses, we think in terms of variables, functions, etc. So when we write and edit code, why do we edit in terms of deleting, inserting, replacing characters – not wrapping, inserting, raising, deleting expressions and statements? I'll also discuss the implementation of tree-edit, which uses a novel combination of the fantastic [tree-sitter](https://github.com/emacs-tree-sitter/elisp-tree-sitter) parser with an embedded logic programming DSL ([miniKanren](http://minikanren.org/), using elisp port [reazon](https://github.com/nickdrozd/reazon)) to power it's syntax tree generation. Check out the GitHub repo [here](https://github.com/ethan-leba/tree-edit)! # Outline - Discuss motivation (Why should I care?) - Demonstrate tree-edit (Live-coding with tree-edit) - Demonstrate tree-edit syntax tree generator (Elevator pitch on miniKanren) [[!inline pages="internal(2021/info/structural-schedule)" raw="yes"]] [[!inline pages="internal(2021/info/structural-nav)" raw="yes"]]