vast

vAST: A (mostly) generic abstract syntax tree generator.

npm install vast
4 downloads in the last month

vAST

A (mostly) generic abstract syntax tree generator.

vAST stands for "(variable) abstract syntax tree".

This is a source code parser. It takes plain text UTF8 source code and generates a tree data structure given a tokenization and classification rule set.

Mostly generic means that there aren't any predefined keywords, tokens, or even character classes. If you want to define whitespace as all "➿" characters or use Kanji for all your keywords, knock yourself out. There are predefined node classes, but how those are generated from source is completely undefined without a rule set. The available classes should be sufficient for any language.

The goal is to make it easier to parse existing languages, define new language syntax, and even create completely new languages.

Node Classes (hypothetical)

  • delimiter
  • word
  • whitespace
  • quote
  • escape
  • literal
  • identifier
  • modifier
  • operator
    • unary
    • binary
    • ternary
  • statement
    • block
    • expression
  • comment

No language has to use all of these classes.

Development

Sublime Text 2/3

You can install the "Directory Settings" package to use the ".sublime-settings" file in the project root.

npm loves you