Completely useless as of now. Goal: Create a grammar and use a parser generator.
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
src
.gitignore
README.md
pacc
test.php

README.md

AQL Parser

The purpose AQL is to be able to turn this:

table { field1, field2, field3 }

into

SELECT table.field1, table.field2, table.field3 FROM table;

or, with a variance of a restraint that will be configurable.

SELECT table.field1, table.field2, table.field3 FROM table WHERE table.active = 1;

Credit

Using this as a Parser Generator to replicate and improve upon AQL.

Run and compile the parser generator

In git directory, run:

$ ./pacc -i src/aql.y  -o lib/AQL/Parser.php -f

To Do:

  • Add tests
  • Make actual SQL out of the AQL. (although this ends up being fairly trivial)
  • Enable a DB adapter so joins can be constructed automatically using foreign keys.
  • Allow for optional table constraints (active = 1)
  • Infinite Recursion for inner queries, and possibly subqueries, the current version does not support subqueries.
  • Fix how the tokens are actually made (currently just stdClass with two properties).