-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
TO-DO list
- complete nearley grammar
- add structure and attribute grammar
- add graph/matrix
- update mermaid (unify attribute to adapt nearley)
- update mermaid (add attri-id: page-component-unit to adapt GUI)
- complete compiler in app
- compiler for mermaid code
- compiler for component/page table
- update react state table to enable GUI
- page table
- component table
- discuss user mode
- update policy
- lock policy
- adjust renderer style
- adjust size
- update tree sibling distance with multiple layers
- add the gap between tree node
DSL example
all 6 types of components' (array/matrix/tree/graph/linkedlist/stack) attributes are:
array | matrix | linkedlist | stack | tree | graph | text | nearley | |
---|---|---|---|---|---|---|---|---|
attribute | value,color,arrow | value,color | id,value,color,arrow | value,color,arrow | id,value,color | node:[id,value,color,arrow,hidden] edge:[value,color] | id,value,color,arrow,hidden | |
example |
therefore to unify DSL and mermaid grammar, there should be 5 attribute in DSL (take the union):
- id
- value
- color
- arrow
- hidden
so as former discussed, the DSL grammar would be like:
data:
array arr = {
structure: [[unit1],[unit1,unit2],[unit1,unit2,unit3], *] # unit_id, required
value: [[1], [1,2], [1,2,3], [1,2,3] ] # value, optional
color: [["blue"], [null,null],[], *] # color, optional
arrow: [[],[null,"cur"],[null,null,"cur"]] # arrow, optional
hidden: [[], [False, True], [False]] # hidden, optional
}
draw:
page p := [0,2] {
show arr[p]
}
# value/color/arrow/hidden data doesn't need to aligh to structure data
# it is correct on grammar but maybe incorrect in rendering
# e.g in structure [[1],[1,2],[1,2,3]] if i want to only color unit "3"
# all of this color data can work:
# [[],[],[null, null, blue]]
# [[null,null,null,null,null], * ,[null, null, blue]]
# [[null,null,null,null,null], [] ,[null, null, blue]]
a simplified example of DSL
data:
array arr = {
structure: [[unit1],[unit1,unit2],[unit1,unit2,unit3], *] # unit_id, required
}
linkedlist li = {
structure: [[unit1],[unit1,unit2],[unit1,unit2,unit3], *] # unit_id, required
}
tree tr = {
structure: [[node1],[node1,node2],[node1,node2,node3], *, *, *]
}
draw:
page p := [0,2] {
show arr[p]
show li[p-1]
}
page p := [3,3] {
show li[3]
}
page i := [4,8] {
show li[8-i]
show tr[i]
}
Do you think this grammar reasonable?
Metadata
Metadata
Assignees
Labels
No labels