I've just added N1QL grammar to https://mingodad.github.io/parsertl-playground/playground/ an Yacc/Lex compatible online editor/tester (select N1QL parser from Examples then click Parse to see a parser tree for the content in Input source).
I hope it can help develop/debug/test/document N1QL !
Any feedback is welcome !