aplbrain/dotmotif

Node- and edge-attribute support in DSL

j6k4m8 opened this issue · 2 comments

Proposed syntax concepts:

Nodes

Inline maplike:

Node1 { type="GABA", z<12 } -> Node2

Pros:

  • Succinct

Cons:

  • Possible duplication or conflicting attributes if map is included on multiple lines for the same node

Postfix where-like:

Node1 -> Node2 | Node1.type = "GABA", Node1.z < 12

Pros:

  • Succinct

Cons:

  • Possible duplication or conflicting attributes if attrs are included on multiple lines for the same node

Footnote constraints

Node1 -> Node2

Node1.type = "GABA"
Node1.z < 12

Pros:

  • Reduces possibility of conflicting constraints
  • Clear syntax; can be standalone in its own macro

Cons:

  • Linecount verbose
  • Decouples attributes from connectivity clauses

Edges

Inline maplike:

A ->{type: "excitatory", neurotransmitter: "ACh"} B

Pros:

  • Inline

Cons:

  • Reduces clarity of language

Postfix where-like:

A -> B | [type: "excitatory", neurotransmitter: "ACh"]

Pros:

  • Inline

Cons:

  • Reduces clarity of language

Infix maplike:

A -[type: "excitatory", neurotransmitter: "ACh"]> B

Pros:

  • Inline

Cons:

  • Reduces clarity of language

Example of a collision:

macro(x, y) {
    x -> y [type == 1 && area >= 15]
    
    x.type = "ACh"
}

macro(A, B)
A -> B [ type: 2 ]

A.type = "Glu"

Fixed in #19