GraphQL parser mostly working
Lassi Kortela 31 Jul 2019 09:55 UTC
We can now parse GitHub's public GraphQL schema (30k lines of text) in
about two seconds using the Chicken Scheme compiler:
$ csc test-read.scm
$ time ./test-read github-schema.public.graphql >/dev/null
real 0m2.256s
user 0m2.132s
sys 0m0.077s
The library is 555 lines of code at
<https://github.com/lassik/graphql-chicken/blob/master/graphql-read.scm>.
It has a hand-rolled recursive-descent lexer and a packrat parser. We
owe this accomplishment to the great packrat library. Without support
like it I would've given up.
It'll be fun to try Chez Scheme at some point to see how fast it can rip
through schemas. I haven't optimized any code at all.