• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ast/H03-May-2022-1,050748

c/H16-Oct-2017-330157

cmake/H16-Oct-2017-1512

go/H07-May-2022-10656

python/H03-May-2022-4226

test/H03-May-2022-568443

.gitignoreH A D16-Oct-2017282 2423

.travis.ymlH A D16-Oct-2017824 2923

AstNode.hH A D16-Oct-2017729 3921

CONTRIBUTING.mdH A D16-Oct-20171.2 KiB3224

GraphQLParser.cppH A D16-Oct-20172.1 KiB7649

GraphQLParser.hH A D16-Oct-20171.6 KiB5816

JsonVisitor.cppH A D16-Oct-20173.1 KiB138108

JsonVisitor.hH A D16-Oct-20173.5 KiB12471

LICENSEH A D16-Oct-20171.5 KiB3123

PATENTSH A D16-Oct-20171.9 KiB3428

README.mdH A D16-Oct-20172.9 KiB8160

dump_json_ast.cppH A D16-Oct-20171 KiB5134

lexer.cppH A D16-Oct-201768.8 KiB2,4541,668

lexer.hH A D16-Oct-20178.6 KiB353210

lexer.lppH A D16-Oct-20176.9 KiB204173

libgraphqlparser.pc.inH A D16-Oct-2017304 1210

location.hhH A D16-Oct-20175.1 KiB193104

parser.tab.cppH A D16-Oct-2017113.5 KiB3,3262,584

parser.tab.hppH A D16-Oct-201720.9 KiB645363

parser.yppH A D03-May-202226.8 KiB696578

position.hhH A D16-Oct-20174.7 KiB181102

stack.hhH A D16-Oct-20173.4 KiB15894

syntaxdefs.hH A D16-Oct-2017579 226

README.md

1# libgraphqlparser
2
3libgraphqlparser is a parser for
4[GraphQL](http://facebook.github.io/graphql/), a query language
5created by Facebook for describing data requirements on complex
6application data models, implemented in C++11. It can be used on its
7own in C++ code (or in C code via the pure C API defined in the `c`
8subdirectory), or you can use it as the basis for an extension module
9for your favorite programming language instead of writing your own
10parser from scratch.
11
12## Example
13
14The provided `dump_json_ast` is a simple program that reads GraphQL
15text on stdin and prints a JSON representation of the AST to stdout.
16
17The `python` subdirectory contains an example Python binding for the
18pure C API.
19
20## Requirements
21
22libgraphqlparser requires a C++ compiler that supports C++11. It
23also requires Mac OS X or Linux.
24
25To run tests, please download googletest from
26https://github.com/google/googletest/archive/release-1.8.0.zip
27and unzip it in the `test` subdirectory.
28
29## Building libgraphqlparser
30
31libgraphqlparser is built with [CMake](http://www.cmake.org/). If a
32sufficiently-recent version of [Flex](http://flex.sourceforge.net/) and [Bison](http://www.gnu.org/software/bison/) are installed on your
33system, it will use them; otherwise, it will rely on the checked-in
34`parser.tab.{c,h}pp` and `lexer.{h,cpp}`.
35
36To build libgraphqlparser from source:
37
38```
39$ # inside the project root:
40$ cmake .
41$ make
42```
43
44Then, to install it on your system:
45
46```
47$ make install
48```
49
50## How libgraphqlparser works
51
52libgraphqlparser uses flex and bison to generate a C++ parser for
53GraphQL. These tools work well but have idiosyncratic interfaces by
54modern standards, so GraphQLParser.h provides a simple interface to
55parse GraphQL.
56
57In order to make it simpler to write code based around the GraphQL
58AST, libgraphqlparser includes an extremely simple code generation
59framework in the `ast/` subdirectory. This framework is used to build
60the AST classes themselves, as well as a visitor over the AST. It may
61be easier to understand the output of the generation steps directly
62(i.e., Ast.h, Ast.cpp, and AstVisitor.h) rather than trying to read
63the generation scripts. Simply building libgraphqlparser will cause
64these files to be generated.
65
66libgraphqlparser also uses the AST generation framework to build a
67pure C API in the `c` subdirectory. This API can be used from C code,
68and it should also simplify the task of creating bindings to other
69programming languages.
70
71## License
72libgraphqlparser is BSD-licensed. We also provide an additional patent grant.
73
74## Related Projects
75
76- [graphql-parser (Ruby interface)](https://github.com/Shopify/graphql-parser)
77- [py-graphqlparser (Python interface)](https://github.com/elastic-coders/py-graphqlparser)
78- [graphql_parser (Elixir interface)](https://github.com/aarvay/graphql_parser)
79- [graphql-parser-php (PHP interface)](https://github.com/dosten/graphql-parser-php)
80- [graphql-libgraphqlparser (Ruby interface)](https://github.com/rmosolgo/graphql-libgraphqlparser-ruby)
81