GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - khakha010/libgraphqlparser: A GraphQL query parser in C++ with C and C++ APIs

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

108 Commits
108 Commits

Folders and files

NameName
Last commit message
Last commit date
ast
ast
 
 
c
c
 
 
cmake
cmake
 
 
go
go
 
 
parsergen
parsergen
 
 
python
python
 
 
test
test
 
 
.clang-tidy
.clang-tidy
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
AstNode.h
AstNode.h
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
GraphQLParser.cpp
GraphQLParser.cpp
 
 
GraphQLParser.h
GraphQLParser.h
 
 
JsonVisitor.cpp
JsonVisitor.cpp
 
 
JsonVisitor.h
JsonVisitor.h
 
 
LICENSE
LICENSE
 
 
README.clang-tidy
README.clang-tidy
 
 
README.md
README.md
 
 
clang-tidy-all.sh
clang-tidy-all.sh
 
 
cloud.google.com.html
cloud.google.com.html
 
 
dump_json_ast.cpp
dump_json_ast.cpp
 
 
lexer.lpp
lexer.lpp
 
 
libgraphqlparser.pc.in
libgraphqlparser.pc.in
 
 
parser.ypp
parser.ypp
 
 
syntaxdefs.h
syntaxdefs.h
 
 

Repository files navigation

libgraphqlparser

libgraphqlparser is a parser for GraphQL, a query language created by Facebook for describing data requirements on complex application data models, implemented in C++11. It can be used on its own in C++ code (or in C code via the pure C API defined in the c subdirectory), or you can use it as the basis for an extension module for your favorite programming language instead of writing your own parser from scratch.

Example

The provided dump_json_ast is a simple program that reads GraphQL text on stdin and prints a JSON representation of the AST to stdout.

The python subdirectory contains an example Python binding for the pure C API.

Requirements

libgraphqlparser requires a C++ compiler that supports C++11. It also requires Mac OS X or Linux.

To run tests, please download googletest from https://github.com/google/googletest/archive/release-1.8.0.zip and unzip it in the test subdirectory.

Building libgraphqlparser

libgraphqlparser is built with CMake. If a sufficiently-recent version of Flex and Bison are installed on your system, it will use them; otherwise, it will rely on the checked-in parser.tab.{c,h}pp and lexer.{h,cpp}.

To build libgraphqlparser from source:

$ # inside the project root:
$ cmake .
$ make

Then, to install it on your system:

$ make install

How libgraphqlparser works

libgraphqlparser uses flex and bison to generate a C++ parser for GraphQL. These tools work well but have idiosyncratic interfaces by modern standards, so GraphQLParser.h provides a simple interface to parse GraphQL.

In order to make it simpler to write code based around the GraphQL AST, libgraphqlparser includes an extremely simple code generation framework in the ast/ subdirectory. This framework is used to build the AST classes themselves, as well as a visitor over the AST. It may be easier to understand the output of the generation steps directly (i.e., Ast.h, Ast.cpp, and AstVisitor.h) rather than trying to read the generation scripts. Simply building libgraphqlparser will cause these files to be generated.

libgraphqlparser also uses the AST generation framework to build a pure C API in the c subdirectory. This API can be used from C code, and it should also simplify the task of creating bindings to other programming languages.

License

libgraphqlparser is MIT-licensed.

Related Projects

  • graphql-parser (Ruby interface)
  • py-graphqlparser (Python interface)
  • graphql_parser (Elixir interface)
  • graphql-parser-php (PHP interface)
  • graphql-libgraphqlparser (Ruby interface)

About

A GraphQL query parser in C++ with C and C++ APIs

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.