1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
[[!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"]]
<!-- You can manually edit this file to update the abstract, add links, etc. --->
# Tree-edit: Structural editing for Java, Python, C, and beyond!
Ethan Leba
[[!inline pages="internal(2021/info/structural-schedule)" raw="yes"]]
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)
<!--
- 20 minutes: (brief description/outline)
- discuss motivation
- discuss prior art (paredit, lispy)
- demonstrate tree-edit
- demonstrate and discuss tree-edit syntax tree generation engine
- 40 minutes: (brief description/outline)
same as 20 minutes, with more detailed discussion of the implementation.
-->
[[!inline pages="internal(2021/info/structural-nav)" raw="yes"]]
|