Skip to content

Commit adb11da

Browse files
committed
Add notes about notational convention, links to Appx A, and shorter algorithm example
Closes #238
1 parent bc19747 commit adb11da

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

spec/Appendix A -- Notation Conventions.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,25 @@ StringValue :: `"` StringCharacter+ `"`
180180

181181
## Algorithms
182182

183-
This specification describes some algorithms used by the static and runtime semantics, they're defined in the form of a function-like syntax along with a
184-
list of algorithmic steps to take.
185-
186-
For example, this describes if a fragment should be spread into place given a
187-
runtime {objectType} and the fragment's {fragmentType}:
188-
189-
doesFragmentTypeApply(objectType, fragmentType):
190-
* If {fragmentType} is an Object Type:
191-
* if {objectType} and {fragmentType} are the same type, return {true}, otherwise return {false}.
192-
* If {fragmentType} is an Interface Type:
193-
* if {objectType} is an implementation of {fragmentType}, return {true} otherwise return {false}.
194-
* If {fragmentType} is a Union:
195-
* if {objectType} is a possible type of {fragmentType}, return {true} otherwise return {false}.
196-
183+
This specification describes some algorithms used by the static and runtime
184+
semantics, they're defined in the form of a function-like syntax with the
185+
algorithm's name and the arguments it accepts along with a list of algorithmic
186+
steps to take in the order listed. Each step may establish references to other
187+
values, check various conditions, call other algorithms, and eventually return
188+
a value representing the outcome of the algorithm for the provided arguments.
189+
190+
For example, the following example describes an algorithm named {Fibonacci} which
191+
accepts a single argument {number}. The algoritm's steps produce the next number
192+
in the Fibonacci sequence:
193+
194+
Fibonacci(number):
195+
* If {number} is {0}:
196+
* Return {1}.
197+
* If {number} is {1}:
198+
* Return {2}.
199+
* Let {previousNumber} be {number} - {1}.
200+
* Let {previousPreviousNumber} be {number} - {2}.
201+
* Return {Fibonacci(previousNumber)} + {Fibonacci(previousPreviousNumber)}.
202+
203+
Note: Algorithms described in this document are written to be easy to understand.
204+
Implementers are encouraged to include equivalent but optimized implementations.

spec/GraphQL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ is equivalent. Algorithms described in this document are written to be easy to
7474
understand. Implementers are encouraged to include equivalent but
7575
optimized implementations.
7676

77+
See [Appendix A](#sec-Appendix-Notation-Conventions) for more details
78+
about the definition of algorithms and other notational conventions used in this
79+
document.
80+
7781

7882
**Non-Normative Portions**
7983

spec/Section 2 -- Language.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ tokens (indivisible lexical units). These tokens are defined in a lexical
1010
grammar which matches patterns of source characters (defined by a
1111
double-colon `::`).
1212

13+
Note: See [Appendix A](#sec-Appendix-Notation-Conventions) for more details about the definition of lexical and syntactic grammar and other notational conventions
14+
used in this document.
15+
1316

1417
## Source Text
1518

0 commit comments

Comments
 (0)