<commit_before># tree-sitter compiler

Incremental parsers for node

[![Build Status](https://travis-ci.org/maxbrunsfeld/node-tree-sitter-compiler.svg?branch=master)](https://travis-ci.org/maxbrunsfeld/node-tree-sitter-compiler)

### Installation

```
npm install tree-sitter-compiler
```

### Creating a language

Create a `grammar.js` in the root directory of your module. This file
should export a single function that takes an object containing the rule
builder functions, and returns an object describing the language's grammar:

```js
module.exports = grammar({
  name: "arithmetic",

  extras: $ => [$.comment, /\s/],

  rules: {
    program: $ => repeat(choice(
      $.assignment_statement,
      $.expression_statement
    )),

    assignment_statement: $ => seq(
      $.variable, "=", $.expression, ";"
    ),

    expression_statement: $ => seq(
      $.expression, ";"
    ),

    expression: $ => choice(
      $.variable,
      $.number,
      prec(1, seq($.expression, "+", $.expression)),<commit_msg>Fix out-of-date description in readme<commit_after># tree-sitter compiler

Incremental parsers for node

[![Build Status](https://travis-ci.org/maxbrunsfeld/node-tree-sitter-compiler.svg?branch=master)](https://travis-ci.org/maxbrunsfeld/node-tree-sitter-compiler)

### Installation

```
npm install tree-sitter-compiler
```

### Creating a language

Create a `grammar.js` in the root directory of your module. This file
should create and export a grammar object using tree-sitter's helper functions:

```js
module.exports = grammar({
  name: "arithmetic",

  extras: $ => [$.comment, /\s/],

  rules: {
    program: $ => repeat(choice(
      $.assignment_statement,
      $.expression_statement
    )),

    assignment_statement: $ => seq(
      $.variable, "=", $.expression, ";"
    ),

    expression_statement: $ => seq(
      $.expression, ";"
    ),

    expression: $ => choice(
      $.variable,
      $.number,
      prec(1, seq($.expression, "+", $.expression)),
{'fraction_non_alphanumeric': 0.15871421396283275, 'fraction_numerical': 0.0010045203415369162, 'mean_word_length': 3.4563758389261743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2385355', 'n_tokens_mistral': 638, 'n_tokens_neox': 603, 'n_words': 146}