itechbear / SimpleQueryParser

A simple C query parser using flex and bison

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimpleQueryParser

A simple query parser generated by flex and bison

Introduction

This is a simple query parser that recognizes logic queries like:

  • this that // Parsed as "this AND that"
  • this AND that
  • this AND NOT that
  • this AND NOT (he AND her)

Compile

  • $ mkdir build
  • $ cd build
  • $ cmake ..
  • $ make

Usage

./parser "this AND that"

Warning

This parser is not thread-safe since it uses global variables while parsing.

For those who may want to embed a thread-safe parser into their own application, please see SimpleQueryParser++

P.S.

This is a toy project. I tried three methods to build a query parser. You can find the other two:

About

A simple C query parser using flex and bison


Languages

Language:C 97.9%Language:Yacc 0.9%Language:C++ 0.4%Language:Lex 0.4%Language:CMake 0.3%Language:Shell 0.1%