Commits

Anonymous committed 683a2cf

Make diagrams look better in Markdown.

Comments (0)

Files changed (1)

tests/Hev.markdown

 
 Test a very simple (and completely ground) program.
 
---
---           __(root)_X_53______
--- (rule    /                   \
---  list)  X 43               33 X   (state)
---        / \                   / \
--- (end) ,   \                 ,   ,
---            \
---             \
---              \
---            23 X  (rule)
---              / \
---             /   \
---            /     \
---           /       \
---          /         \
--- (head)  X 13        ,   (body)
---        / \
---       ,   ,
+    --           __(root)_X_53______
+    -- (rule    /                   \
+    --  list)  X 43               33 X   (state)
+    --        / \                   / \
+    -- (end) ,   \                 ,   ,
+    --            \
+    --             \
+    --              \
+    --            23 X  (rule)
+    --              / \
+    --             /   \
+    --            /     \
+    --           /       \
+    --          /         \
+    -- (head)  X 13        ,   (body)
+    --        / \
+    --       ,   ,
 
     | 43,13,23,53,33
     = TreeLeaf
 
 Test pattern-matching with a variable, causing a single rewrite.
 
---
---           __(root)_X_81______
--- (rule    /                   \
---  list)  X 49               73 X   (state)
---        / \                   / \
--- (end) ,   \              64 X   \
---            \               / \   \
---             \             ,   ,   X 17
---              \                   / \
---            36 X  (rule)         ,   X 4
---              / \                   / \
---             /   \                 ,   ,
---            /     \
---           /       \
---          /         \
--- (head)  X 25     16 X   (body)
---        / \         / \
---     9 X   +       +   ,
---      / \
---     ,   ,
+    --           __(root)_X_81______
+    -- (rule    /                   \
+    --  list)  X 49               73 X   (state)
+    --        / \                   / \
+    -- (end) ,   \              64 X   \
+    --            \               / \   \
+    --             \             ,   ,   X 17
+    --              \                   / \
+    --            36 X  (rule)         ,   X 4
+    --              / \                   / \
+    --             /   \                 ,   ,
+    --            /     \
+    --           /       \
+    --          /         \
+    -- (head)  X 25     16 X   (body)
+    --        / \         / \
+    --     9 X   +       +   ,
+    --      / \
+    --     ,   ,
 
---
--- One rewrite of state: + matches branch at 17, new state becomes:
---
---        X
---       / \
---   17 X   ,
---     / \
---    ,   X 4
---       / \
---      ,   ,
--- 
+After one rewrite of state: + matches branch at 17, new state becomes:
+
+    --        X
+    --       / \
+    --   17 X   ,
+    --     / \
+    --    ,   X 4
+    --       / \
+    --      ,   ,
 
     | 49,9,25+36+16,81,64,73,17,4
     = TreeBranch (TreeBranch TreeLeaf (TreeBranch TreeLeaf TreeLeaf)) TreeLeaf
 
 Test several rewrites of state.  The state is reduced to a single leaf.
 
---
---           __(root)_X_4_______
--- (rule    /                   \
---  list)  X 3                 2 X   (state)
---        / \                   / \
--- (end) ,   \                 /   \
---            \               /     \
---             \             X 1   1 X
---              \           / \     / \
---             2 X  (rule) ,   ,   ,   ,
---              / \
---             /   \
---            /     \
---           /       \
---          /         \
--- (head)  X 1         *   (body)
---        / \
---       *   *
+    --           __(root)_X_4_______
+    -- (rule    /                   \
+    --  list)  X 3                 2 X   (state)
+    --        / \                   / \
+    -- (end) ,   \                 /   \
+    --            \               /     \
+    --             \             X 1   1 X
+    --              \           / \     / \
+    --             2 X  (rule) ,   ,   ,   ,
+    --              / \
+    --             /   \
+    --            /     \
+    --           /       \
+    --          /         \
+    -- (head)  X 1         *   (body)
+    --        / \
+    --       *   *
 
     | 3*1*2*4,1,2,1
     = TreeLeaf
 while a top-down strategy produces a single branch.
 (Work it out by hand if you doubt me!)
 
---
---           __(root)_X_99______
--- (rule    /                   \
---  list)  X 71                  \
---        / \                     \
--- (end) ,   \                     \
---            \                     \
---             \                     X 61 (state)
---              \                   / \
---            29 X  (rule)         /   \
---              / \               /     \
---             /   \          37 X       X 47
---            /     \           / \     / \
---           /       \         /   \   ,   ,
---          /         \     6 X   7 X
--- (head)  X 27 (body) *     / \   / \
---        / \               ,   , ,   ,
---       /   \
---    8 X     X 19
---     / \   / \
---    +   * ,   ,
+    --           __(root)_X_99______
+    -- (rule    /                   \
+    --  list)  X 71                  \
+    --        / \                     \
+    -- (end) ,   \                     \
+    --            \                     \
+    --             \                     X 61 (state)
+    --              \                   / \
+    --            29 X  (rule)         /   \
+    --              / \               /     \
+    --             /   \          37 X       X 47
+    --            /     \           / \     / \
+    --           /       \         /   \   ,   ,
+    --          /         \     6 X   7 X
+    -- (head)  X 27 (body) *     / \   / \
+    --        / \               ,   , ,   ,
+    --       /   \
+    --    8 X     X 19
+    --     / \   / \
+    --    +   * ,   ,
 
     | 71+8*27,19,29*99,6,37,7,61,47
     = TreeBranch TreeLeaf TreeLeaf
 
 Test multiple rules.
 
---
---                            _________(root)__X__188___________
---                           /                                  \
---             (rule list)  X 154                            111 X   (state)
---                         / \                                  / \
---                        /   \                                ,   X 91
---                       /     \                                  / \
---                      /       \                                ,   X 77
---                     /         \                                  / \
---                    /       137 X  (rule)                        ,   ,
---                   /           / \
---                  /           /   \
---                 /    (head) X 6   , (body)
---                /           / \
---               /         2 X   ,
---              /           / \
--- (rule node) X 103       ,   ,
---            / \
---     (end) ,   X (rule) 86
---              / \
---             /   \
---            /     \
---    (head) X 5   9 X (body)
---          / \     / \
---         ,   X 4 -   ,
---            / \
---           ,   -
+    --                            _________(root)__X__188___________
+    --                           /                                  \
+    --             (rule list)  X 154                            111 X   (state)
+    --                         / \                                  / \
+    --                        /   \                                ,   X 91
+    --                       /     \                                  / \
+    --                      /       \                                ,   X 77
+    --                     /         \                                  / \
+    --                    /       137 X  (rule)                        ,   ,
+    --                   /           / \
+    --                  /           /   \
+    --                 /    (head) X 6   , (body)
+    --                /           / \
+    --               /         2 X   ,
+    --              /           / \
+    -- (rule node) X 103       ,   ,
+    --            / \
+    --     (end) ,   X (rule) 86
+    --              / \
+    --             /   \
+    --            /     \
+    --    (head) X 5   9 X (body)
+    --          / \     / \
+    --         ,   X 4 -   ,
+    --            / \
+    --           ,   -
 
     | 103,5,4-86-9,154,2,6,137,188,111,91,77
     = TreeLeaf
     
     25,20*24,20,1*26,25
 
---
---           __(root)_X_26______
--- (rule    /                   \
---  list)  X 25                  X (state)
---        / \                   / \
--- (end) ,   \                 ,   ,
---            \
---             \
---              \
---            24 X  (rule)
---              / \
---             /   \
---            /     \
---           /       \
---          /         \
--- (head)  X   (body)  X 20
---        / \         / \
---       ,   *       ,   X 1
---                      / \
---                     ,   *
+    --           __(root)_X_26______
+    -- (rule    /                   \
+    --  list)  X 25                  X (state)
+    --        / \                   / \
+    -- (end) ,   \                 ,   ,
+    --            \
+    --             \
+    --              \
+    --            24 X  (rule)
+    --              / \
+    --             /   \
+    --            /     \
+    --           /       \
+    --          /         \
+    -- (head)  X   (body)  X 20
+    --        / \         / \
+    --       ,   *       ,   X 1
+    --                      / \
+    --                     ,   *
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.