From 57a9651fe9fa6a67cc6762b0ab9373d97f845375 Mon Sep 17 00:00:00 2001 From: Scott Blomquist Date: Tue, 12 Dec 2023 13:15:00 -0800 Subject: [PATCH] Add examples of mappings from regex tree to type tree --- doc/spec.md | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 doc/spec.md diff --git a/doc/spec.md b/doc/spec.md new file mode 100644 index 0000000..919b3b6 --- /dev/null +++ b/doc/spec.md @@ -0,0 +1,140 @@ +# List of tuple + + + + + + +
+ +```mermaid +graph TD + Start["List<(char,char)>"] --> tuple["(char,char)"] + tuple --> char1["char"] + tuple --> char2["char"] +``` + + +```mermaid +graph TD + A1["((.)(.))+"] + A1 --> tuple["(.)(.)"] + tuple --> char1["."] + tuple --> char2["."] +``` +
+ +# List of primitive type + + + + + + + + + +
+ +```mermaid +graph TD + Start["List#lt;int>"] --> int +``` + + +```mermaid +graph TD + A1["((\d+),? ?)+"] + A1 --> int["(\d+),? ?"] +``` + + +```mermaid +graph TD + Start["List#lt;int>"] --> int +``` + + +```mermaid +graph TD + A1["(\d+ ?)+"] + A1 --> int["\d+ ?"] +``` +
+ +# Dictionary of tuple including list + + + + + + +
+ +```mermaid +graph TD + Start["Dictionary#lt;int,List#lt;string>>"] --> tuple["(int,List#lt;string>)"] + tuple --> int + tuple --> list["List#lt;string>"] + list --> string +``` + + +```mermaid +graph TD + A1["((\d+) = ((\w+),? ?)+)+"] + A1 --> tuple["(\d+) = ((\w+),? ?)+"] + tuple --> int["\d+"] + tuple --> list["(\w+),? ?"] + list --> string["\w+"] +``` +
+ +# Record with two values + + + + + + +
+ +```mermaid +graph TD + Start["record(long,long)"] --> long1[long] + Start --> long2[long] +``` + + +```mermaid +graph TD + A1["mem\[(\d+)\] = (\d+)"] + A1 --> long1["\d+"] + A1 --> long2["\d+"] +``` +
+ +# List of List of List of char + + + + + + +
+ +```mermaid +graph TD + Start["List#lt;List#lt;List#lt;char>>>"] --> listlist["List#lt;List#lt;char>>"] + listlist --> list["List#lt;char>"] + list --> char +``` + + +```mermaid +graph TD + A1["(((\w)+\s+)+,? ?)+"] --> listlist["((\w)+\s+)+,? ?"] + listlist --> list["(\w)+\s+"] + list --> char["\w"] +``` +