Yes, there is a EBNF for Cadence.
Syntax highlighting for GitHub is implemented in the
Linguist supports TextMate grammars, and we already have a TextMate grammar for Cadence in the Visual Studio Code extension.
However, GitHub "[...] prefers that each new file extension be in use in hundreds of repositories before supporting them in Linguist". Once we have reached this threshold for Cadence, we should add support for Cadence to linguist.
ExecuteScript require a
The context has a
PredeclaredValues field, which can be filled with
Optionally, value declarations may have a predicate function
Available of type
The checker calls this function for every location that is checked,
to determine if the value declaration should be available/declared in the given location.
For example, this allows declaring a function that is only available in the service account.
In this case, the availability function would need to check if the location is an
and that the address of the address location is the address of the service account.
Cadence's parser is implemented as a hand-written recursive descent parser which uses operator precedence parsing. The recursive decent parsing technique allows for greater control, e.g. when implementing whitespace sensitivity, ambiguities, etc. The handwritten parser also allows for better / great custom error reporting and recovery.
The operator precedence parsing technique avoids constructing a CST and the associated overhead, where each grammar rule is translated to a CST node. For example, a simple integer literal would be "boxed" in several outer grammar rule nodes.