Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Do you have the AST definition document? #57

Open
lunexnocty opened this issue Apr 8, 2020 · 1 comment
Open

Do you have the AST definition document? #57

lunexnocty opened this issue Apr 8, 2020 · 1 comment

Comments

@lunexnocty
Copy link

I'm learning this project and I want a document about how AST defined just like https://esprima.readthedocs.io/en/latest/syntax-tree-format.html

@jdrew1303
Copy link

Hey @lunexnocty

I don't think there is any documentation like this. There are still a few options though:

  • I've a project that generated SQL from the AST output by sqlite-parser. The code is quite good as an example of using the AST. It should cover all paths (I haven't run it with a current version of the library but the AST has been fairly stable). You can take a look here: https://github.com/jdrew1303/sqlgenerate/blob/master/sqlgenerate.js
  • You can look through the test folder. There are examples of the SQL and the json ast generated by this library. It's been the main guide I've used while working with the library.
  • You can use GrammKit to generate railroad diagrams of the language. You might need to preprocess the peg file before using this. pegjs-strip might be of some help with this.

Hope this helps 👍 👋

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants