Joel Grunbaum
2021-07-14 592993dcbb6ab134991836734eb68ebbd31c9946
commit | author | age
1543c6 1 #+TITLE:Spec for syntax tree
JG 2
3 * Tree components
4 - Document :: Root of AST, contains metadata of title, date, author
5 - Block :: Paragraph level
6 - Table :: 
7 - Line :: Main component of Block
8 - Code :: Contains text and language
9 - Heading :: Contains level and words
10 - List :: Contains level, number and words
11 - Word :: Token of text
12 - Text :: String single word
13 - MathDisp :: Display level math
14 - MathInline :: Inline level math
15 - Bold :: Bold text, can have multiple words
16 - Italic :: Italic text, can have multiple words
17 - Verbatim :: Verbatim text, can have multiple words
18 - Link :: Link to other place, containing link text and link destination
19
20 Document: Block*
21 Block: Table | Line* | Code
22 Table: Word* (2d array)
23 Code: Straight strings
24 Line: Heading | List | Word* | MathDisp
25 Word: MathInline | Link | Format
26 Format: Bold | Italic | Verbatim | Text
27 Italic: Format
28 Bold: Format
29 Verbatim: Format
30 Link: Text
31 Heading: Word*
32 List: Word*
33
34 * Language features and syntax
35 ** Org
36 *** Document
37 Title is ~#+TITLE: [Text]~.
38 Author is ~#+AUTHOR: [Text]~.
39 Date is ~#+DATE: [Text]~.
40 *** Block
41 Block are defined by empty/blank lines.
42 *** Table
43 Tables are formatted with vertical pipes separating columns.
44 There may be formatting around boxes of -----.
45 *** Code
46 Code blocks are defined by ~#BEGIN_SRC [language]~ and ~#END_SRC~.
47 There are lines of text in between.
48 *** Heading
49 Heading levels are denoted by the number of '*' beginning the line.
50 REGEX: ~\** [[:TEXT:]]~.
51 *** List
52 List level is denoted by half the number of spaces at the start of the line.
53 The list number is #[.)] or if unordered [-+].
54 ORDERED REGEX: ~[ ]*[[:DIGIT:]]*[.)]~.
55 UNORDERED REGEX: ~[ ]*[-+]~.
56 *** Math
57 Display math is denoted between ~$$ $$~ or ~\[ \]~.
58 Inline math is ~$ $~.
59 *** Formatting
60 Italic is between ~/ /~.
61 Bold is between ~* *~.
62 Verbatim is between ~\~ \~~.
63 *** Link
64 Links are ~[[destination][text]]~.
65 *** Comments
66 Comments begin with have the regex "^# " and can be omitted.