chess.gbnf 565 B

12345678910111213
  1. # Specifies chess moves as a list in algebraic notation, using PGN conventions
  2. # Force first move to "1. ", then any 1-2 digit number after, relying on model to follow the pattern
  3. root ::= "1. " move " " move "\n" ([1-9] [0-9]? ". " move " " move "\n")+
  4. move ::= (pawn | nonpawn | castle) [+#]?
  5. # piece type, optional file/rank, optional capture, dest file & rank
  6. nonpawn ::= [NBKQR] [a-h]? [1-8]? "x"? [a-h] [1-8]
  7. # optional file & capture, dest file & rank, optional promotion
  8. pawn ::= ([a-h] "x")? [a-h] [1-8] ("=" [NBKQR])?
  9. castle ::= "O-O" "-O"?