AlaSQL / alasql

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
http://alasql.org
MIT License
7.01k stars 650 forks source link

Change parser output AST format from classes to JSON object #182

Open agershun opened 9 years ago

agershun commented 9 years ago

Currently AlaSQL parser produces AST (abstract syntax tree) with classes on nodes. I received coule requests to change it to simple JSON (like WebSQLShim does).

mathiasrw commented 9 years ago

As I hear it its a request to change the format of the AST - cause the JSON will still represent a syntax tree

Do we have any hints on what it will benefit? What is the need behind? Is it to interact with the syntax tree?

If its to have an easier way of debugging an export of AST to JSON might be an option.

agershun commented 9 years ago

Yes, plus it will:

  1. Separate parser code from main body (there is no need to call new yy.CreateTable({tableid:$1}); in the parser
  2. Other people can generate JSON from their frontend, for example, I received a request from Clujure guys
  3. We can use this JSON as a standard API and add generators for other databases, like Mongo or other.
mathiasrw commented 9 years ago

Sounds good !

mathiasrw commented 9 years ago

AS I recall it last time I can the .compile() I got a JSON back - is this issue resolved?