# Modality Language BNF Grammar
This document provides the formal Backus-Naur Form (BNF) grammar specification for the Modality temporal logic language.
## Complete BNF Grammar
```
<file> ::= <comment>* <model> <comment>*
<model> ::= "model" <identifier> ":" <graph>*
<graph> ::= "graph" <identifier> ":" <transition>*
<transition> ::= <identifier> "-->" <identifier> [":" <property-list>]
<property-list> ::= <property> [<property-list>]
<property> ::= <property-sign> <identifier>
<identifier> ::= <letter> [<identifier-char>]
"A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
<comment> ::= "//" <any-char>* <newline>
<any-char> ::= <any-character-except-newline>
<newline> ::= "\n" | "\r" | "\r\n"
```
## Grammar Elements
### Terminals
- `"model"` - Keyword to start a model definition
- `"graph"` - Keyword to start a graph definition
- `"-->"` - Arrow operator for transitions
- `":"` - Colon separator
- `"+"` - Positive property sign
- `"-"` - Negative property sign
- `"//"` - Comment start
- `<letter>` - Alphabetic characters (a-z, A-Z)
- `<digit>` - Numeric characters (0-9)
- `"_"` - Underscore character
- `<newline>` - Line ending characters
### Non-terminals
- `<file>` - Complete Modality file
- `<model>` - Model definition with name and graphs
- `<graph>` - Graph definition with name and transitions
- `<transition>` - Transition between two nodes with optional properties
- `<property-list>` - List of properties (zero or more)
- `<property>` - Single property with sign and name
- `<property-sign>` - Property sign (+ or -)
- `<identifier>` - Valid identifier name
- `<identifier-char>` - Valid character for identifiers
- `<comment>` - Single-line comment
- `<any-char>` - Any character except newline
- `<newline>` - Line ending
## Grammar Rules Explained
### File Structure
```
<file> ::= <comment>* <model> <comment>*
```
A file consists of optional comments, followed by a model, followed by optional comments.
### Model Definition
```
<model> ::= "model" <identifier> ":" <graph>*
```
A model starts with the keyword "model", followed by an identifier, a colon, and zero or more graphs.
### Graph Definition
```
<graph> ::= "graph" <identifier> ":" <transition>*
```
A graph starts with the keyword "graph", followed by an identifier, a colon, and zero or more transitions.
### Transition Definition
```
<transition> ::= <identifier> "-->" <identifier> [":" <property-list>]
```
A transition consists of two identifiers separated by "-->" (three dashes followed by greater than), optionally followed by a colon and property list.
### Property List
```
<property-list> ::= <property> [<property-list>]
```
A property list is a recursive definition allowing one or more properties.
### Property
```
<property> ::= <property-sign> <identifier>
```
A property consists of a sign (+ or -) followed by an identifier.
### Identifier
```
<identifier> ::= <letter> [<identifier-char>]