Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

joeyshi12/pql-parser

Repository files navigation

pql-parser

node.js.yml npm-publish.yml npm

Plot query language parser.

A 2D plot generation tool made with this parser is hosted at https://devtools.joeyshi.xyz/pql_compiler.

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"

About

Plot query language parser library

Topics

Resources

License

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /