[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/clojure-ts-mode 6ddcd2cc0f 39/71: Further documentation on
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/clojure-ts-mode 6ddcd2cc0f 39/71: Further documentation on syntax trees and nodes |
Date: |
Fri, 25 Aug 2023 03:59:35 -0400 (EDT) |
branch: elpa/clojure-ts-mode
commit 6ddcd2cc0f5e7da401e9bc77d6572239362dfb10
Author: dannyfreeman <danny@dfreeman.email>
Commit: dannyfreeman <danny@dfreeman.email>
Further documentation on syntax trees and nodes
---
doc/design.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/doc/design.md b/doc/design.md
index 99bf6d68da..7fcab67764 100644
--- a/doc/design.md
+++ b/doc/design.md
@@ -6,6 +6,9 @@ Clojure-ts-mode is based on the tree-sitter-clojure grammar.
If you want to contribute to clojure-ts-mode, it is recommend that you
familiarize yourself with how tree-sitter works.
The official documentation is a great place to start:
https://tree-sitter.github.io/tree-sitter/
+These guides for Emacs tree-sitter development are also useful
+- https://casouri.github.io/note/2023/tree-sitter-starter-guide/index.html
+- `Developing major modes with tree-sitter` (From the Emacs 29+ Manual, `C-h
i`, search for `tree-sitter`)
In short:
Tree-sitter is a tool that generates parser libraries for programming
languages, and provides an API for interacting with those parsers.
@@ -18,7 +21,12 @@ Emacs can use these generated parsers to provide major modes
with things like sy
- Parser: A dynamic library compiled from C source code that is generated by
the tree-sitter tool. A parser reads source code for a particular language and
produces a syntax tree.
- Grammar: The rules that define how a parser will create the syntax tree for
a language. The grammar is written in javascript. Tree-sitter tooling consumes
the grammar as input and outputs C source (which can be compiled into a parser)
- Syntax Tree: a tree data structure comprised of syntax nodes that represents
some source code text.
+ - Concrete Syntax Tree: Syntax trees that contain nodes for every token in
the source code, including things likes brackets and parentheses. Tree-sitter
creates Concrete Syntax Trees.
+ - Abstract Syntax Tree: A syntax tree with less important details removed.
An AST may contain a node for a list, but not individual parentheses.
Tree-sitter does not create Abstract Syntax Trees.
- Syntax Node: A node in a syntax tree. It represents some subset of a source
code text. Each node has a type, defined by the grammar used to produce it.
Some common node types represent language constructs like strings, integers,
operators.
+ - Named Syntax Node: A node that can be identified by a name given to it
in the tree-sitter Grammar. In clojure-ts-mode, `list_lit` is a named node for
lists.
+ - Anonymous Syntax Node: A node that cannot be identified by a name. In
the Grammar these are identified by simple strings, not by complex Grammar
rules. In clojure-ts-mode, `"("` and `")"` are anonymous nodes.n
+- Font Locking: What Emacs calls "Syntax Highlighting".
## tree-sitter-clojure
@@ -123,7 +131,8 @@ And the primary downside: Semantics must be
(re)-implemented in tools that consu
#### Further Reading
-https://github.com/sogaiu/tree-sitter-clojure/blob/master/doc/scope.md
+- https://github.com/sogaiu/tree-sitter-clojure/blob/master/doc/scope.md
+-
https://tree-sitter.github.io/tree-sitter/using-parsers#named-vs-anonymous-nodes
## Syntax Highlighting
- [nongnu] elpa/clojure-ts-mode 359521e61f 52/71: Add MELPA Stable badge and Make 0.1.0 version, (continued)
- [nongnu] elpa/clojure-ts-mode 359521e61f 52/71: Add MELPA Stable badge and Make 0.1.0 version, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 54a69be9cd 29/71: Use eldev to lint the project, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode aaac7df2cc 26/71: Remove unneeded progn, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode ae3790adc0 65/71: Allow user to configure highlighting comment macro body, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 3e4c55fab1 71/71: 0.1.4 in package header, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode c9f1ed357d 13/71: Refer users to upstream tree-sitter-clojure, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 30d1d8a3f3 02/71: Add dir-locals, try to fix license badge, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 25df890b68 21/71: Remove old test file, no longer needed, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 19b8e4260b 53/71: Require Emacs 29, not 29.1, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode faae888096 07/71: Add test file, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 6ddcd2cc0f 39/71: Further documentation on syntax trees and nodes,
ELPA Syncer <=
- [nongnu] elpa/clojure-ts-mode 5aa548a8a5 41/71: Remove outdated comment, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode fefab3540c 58/71: Explicitly declare the syntax-table used by clojure-ts-mode, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode d8207ac7c3 34/71: Update the names of a couple of identifiers, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 2d78f6be4f 59/71: Remove redundant docstring info from major mode, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 061d1b3e23 50/71: Add melpa badge to readme, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode ae8f3e3805 30/71: Shorten clojure-ts-mode-* to clojure-ts-* for non-public functions, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode b2380557c9 51/71: Add missing markdown reference, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 3e2a1b8ec9 03/71: More readme badge and link fixes, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 9640b445eb 33/71: Add a badge for the lint workflow, ELPA Syncer, 2023/08/25
- [nongnu] elpa/clojure-ts-mode 4578449356 12/71: indent testing, end_of_defun bug test (bug is in treesitter), ELPA Syncer, 2023/08/25