All Projects → soforth → sql-parser

soforth / sql-parser

Licence: other
golang version of SQL parser, substential copy-and-past from the book <flex & bison>

Programming Languages

Bison
20 projects
Makefile
30231 projects

sql-parser

sql-parser is parser substantially copy-and-paste from the book <flex & biosn>

  • generates Reverse Polish Notation (RPN) of SQL statements

  • integrates with GO’s yacc and nex instead of Flex & BISON

I wrote this code to get acquainted with GO and SQL for further develop purpose. This is a subset of SQL. The ultimate definitions for SQL are the standards documents published by ANSI and ISO including ISO/IEC 9075-2:2003, which defines SQL, and a variety of related documents that define the way to embed SQL in other programming languages and in XML.

Installation

Get nex tool:

$go get github.com/blynn/nex
$cd github.com/blynn/nex
$go build
$ln -s nex /usr/bin/nex

Get sql-parser

$go get github.com/soforth/sql-parser
$cd github.com/soforth/sql-parser

Run:

$make
$./sql-parser < sql

Example

$cat sql
insert into `t1` select * from t2 where t2.c > 100;
$./sql-parser < sql
SELECTALL
TABLE t2
FIELDNAME t2.c
NUMBER 100
CMP 2
WHERE
SELECT 0 1 1
INSERTSELECT 0 t
STMT

LICENSE

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].