Skip to content

Commit

Permalink
abandoned exploration of alternative association operators, now only …
Browse files Browse the repository at this point in the history
…using '|'
  • Loading branch information
akollegger committed Oct 29, 2024
1 parent 4e46523 commit 562a7a2
Show file tree
Hide file tree
Showing 10 changed files with 1,367 additions and 1,327 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ npm-debug.log
yarn-error.log
testem.log
/typings
migrations.json

# System Files
.DS_Store
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NearleyGram

Gram is a subject based notation for structured data.
Gram is a subject-oriented notation for structured data.

This project is a [nearley](https://nearley.js.org) grammar for gram, providing
an EBNF-like description that produces convenient railroad diagrams.
Expand All @@ -12,5 +12,5 @@ Gram notation describes subjects, which are like objects with benefits.
There are 3 primary structures which can be defined:

- independent subjects: ```(a:Person {name:"ABK"})```
- subject relationships: ```(a)-[:KNOWS]->(b)```
- associated subjects: ```[people | a,b,c]```
- subject relationships: ```(a)-[:KNOWS]->(b)-[:WROTE]->(k)```
- associated subjects: ```[team | a,b,c]```
20 changes: 11 additions & 9 deletions gram.ne
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ PatternElement -> (Annotation _):* (Subject | Path)

Subject -> "[" _ Attributes _ Association:? "]"

Association ->
Membership | Ordering

Membership -> "|" (Labels:? Record:? _ "|"):? _ AssociationMember (_ "," _ AssociationMember):*

Ordering -> ("->" | "-[" Labels:? Record:? "]->") _ AssociationMember (_ "," _ AssociationMember):+
Association -> "|" (Labels:? Record:? _ "|"):? _ AssociationMember (_ "," _ AssociationMember):*

AssociationMember -> (PatternElement | Reference)

Expand Down Expand Up @@ -98,14 +93,14 @@ Null -> "null"

Boolean -> "true" | "false"

Symbol -> [a-zA-Z_] [0-9a-zA-Z_@]:*
Symbol -> [a-zA-Z_] [0-9a-zA-Z_\-]:*

Range ->
NumericLiteral ".." NumericLiteral
| NumericLiteral "..."
| "..." NumericLiteral

NumericLiteral ->
NumericLiteral ->
Integer
| Decimal
| Hexadecimal
Expand All @@ -128,10 +123,12 @@ StringLiteral ->
DoubleQuotedLiteral
| SingleQuotedLiteral
| BacktickStringLiteral
| FencedStringLiteral

DoubleQuotedLiteral -> "\"" NonDoubleQuoteChar:* "\""
SingleQuotedLiteral -> "'" NonSingleQuoteChar:* "'"
BacktickStringLiteral -> "`" [^`]:* "`"
BacktickStringLiteral -> "`" NonBacktickChar:* "`"
FencedStringLiteral -> "```\n" [\s\S]:+ "\n```"

TaggedStringLiteral -> Symbol BacktickStringLiteral

Expand All @@ -144,6 +141,11 @@ NonSingleQuoteChar ->
| "\\" EscapedChars
| "\\'"

NonBacktickChar ->
[^`\n]
| "\\" EscapedChars
| "\\`"

EscapedChars ->
["\\/bfnrt]
| "u" [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9]
Expand Down
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"targetName": "lint"
}
}
]
],
"useLegacyCache": true
}
Loading

0 comments on commit 562a7a2

Please sign in to comment.