Skip to content

Commit

Permalink
Add examples of mappings from regex tree to type tree
Browse files Browse the repository at this point in the history
  • Loading branch information
sblom committed Dec 12, 2023
1 parent f3e0b3f commit 5caaac1
Showing 1 changed file with 140 additions and 0 deletions.
140 changes: 140 additions & 0 deletions doc/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# List of tuple

<table>
<tr>
<td>

```mermaid
graph TD
Start["List<(char,char)>"] --> tuple["(char,char)"]
tuple --> char1["char"]
tuple --> char2["char"]
```
</td>
<td>

```mermaid
graph TD
A1["((.)(.))+"]
A1 --> tuple["(.)(.)"]
tuple --> char1["."]
tuple --> char2["."]
```
</td>
</tr>
</table>

# List of primitive type

<table>
<tr>
<td>

```mermaid
graph TD
Start["List#lt;int>"] --> int
```
</td>
<td>

```mermaid
graph TD
A1["((\d+),? ?)+"]
A1 --> int["(\d+),? ?"]
```
</td>
<td></td>
<td>

```mermaid
graph TD
Start["List#lt;int>"] --> int
```
</td>
<td>

```mermaid
graph TD
A1["(\d+ ?)+"]
A1 --> int["\d+ ?"]
```
</td>
</tr>
</table>

# Dictionary of tuple including list

<table>
<tr>
<td>

```mermaid
graph TD
Start["Dictionary#lt;int,List#lt;string>>"] --> tuple["(int,List#lt;string>)"]
tuple --> int
tuple --> list["List#lt;string>"]
list --> string
```
</td>
<td>

```mermaid
graph TD
A1["((\d+) = ((\w+),? ?)+)+"]
A1 --> tuple["(\d+) = ((\w+),? ?)+"]
tuple --> int["\d+"]
tuple --> list["(\w+),? ?"]
list --> string["\w+"]
```
</td>
</tr>
</table>

# Record with two values

<table>
<tr>
<td>

```mermaid
graph TD
Start["record(long,long)"] --> long1[long]
Start --> long2[long]
```
</td>
<td>

```mermaid
graph TD
A1["mem\[(\d+)\] = (\d+)"]
A1 --> long1["\d+"]
A1 --> long2["\d+"]
```
</td>
</tr>
</table>

# List of List of List of char

<table>
<tr>
<td>

```mermaid
graph TD
Start["List#lt;List#lt;List#lt;char>>>"] --> listlist[List#lt;List#lt;char>>]
listlist --> list[List#lt;char>]
list --> char
```
</td>
<td>

```mermaid
graph TD
A1["(((\w)+\s+)+,? ?)+"] --> listlist["((\w)+\s+)+,? ?"]
listlist --> list["(\w)+\s+"]
list --> char["\w"]
```
</td>
</tr>
</table>

0 comments on commit 5caaac1

Please sign in to comment.