GithubHelp home page GithubHelp logo

joeyshi12 / pql-parser Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 327 KB

Plot query language parser library

Home Page: https://www.npmjs.com/package/pql-parser?activeTab=readme

License: MIT License

TypeScript 100.00%
ast node npm-package parser pql

pql-parser's Introduction

pql-parser

node.js.yml npm-publish.yml npm

Plot query language parser library.

A simple CSV visualizer tool made with this parser is hosted at https://devtools.joeyshi.xyz/csv_vis.

Syntax

PLOT (BAR(category_column, value_column) | LINE(x_column, y_column) | SCATTER(x_column, y_column))
[WHERE <condition>]
[GROUP BY <column>]
[HAVING <condition>]
[LIMIT <limit> [OFFSET <offset>]]

EBNF

<plot_statement> ::= "PLOT" <plot_call> [<where_clause>] [<group_by_clause>] [<having_clause>] [<limit_and_offset_clause>]

<plot_clause> ::= <bar_call> | <line_call> | <scatter_call>

<bar_call> ::= "BAR" "(" <attribute> "," <attribute> ")"

<line_call> ::= "LINE" "(" <attribute> "," <attribute> ")"

<scatter_call> ::= "SCATTER" "(" <attribute> "," <attribute> ")"

<where_clause> ::= "WHERE" <where_condition>

<group_by_clause> ::= "GROUP BY" <identifier>

<having_clause> ::= "HAVING" <having_condition>

<limit_and_offset_clause> ::= "LIMIT" <number> ["OFFSET" <number>]

<boolean_operator> ::= "OR" | "AND"

<attribute> ::= <aggregated_column> ["AS" <identifier>]

<aggregated_column> ::= <aggregation_function> "(" <identifier> ")" | <identifier>

<aggregation_function> ::= "MIN" | "MAX" | "AVG" | "COUNT" | "SUM"

<identifier> ::= <alphabetic> { <alphabetic> | <digit> | "_" }

<where_condition> ::= <where_condition_group> { "OR" <where_condition_group> } | <where_condition_group> { "AND" <where_condition_group> }

<where_condition_group> ::= <identifier> <comparison_operator> <value> | "(" <where_condition> ")"

<having_condition> ::= <having_condition_group> { "OR" <having_condition_group> } | <having_condition_group> { "AND" <having_condition_group> }

<having_condition_group> ::= <aggregated_column> <comparison_operator> <value> | "(" <having_condition> ")"

<comparison_operator> ::= ">" | "<" | ">=" | "<=" | "="

<value> ::= <number> | <string> | "NULL"

<number> ::= <digit> {<digit>}

<string> ::= "'" <alphabetic> {<alphabetic>} "'"

<digit> ::= "0" | ... | "9"

<alphabetic> ::= "A" | ... | "Z" | "a" | ... | "z"

pql-parser's People

Contributors

joeyshi12 avatar

Stargazers

Peter Lee avatar Jarrett Huang avatar

Watchers

Peter Lee avatar  avatar

pql-parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.