Skip to content

caffeinelabs/tree-sitter-motoko

Repository files navigation

tree-sitter-motoko

A tree-sitter grammar for the Motoko programming language.

Why does this exist?

There is an existing grammar at https://github.com/polychromatist/tree-sitter-motoko

I wanted to re-familiarize myself with every corner of Motoko's syntax, so I decided to implement my own. The existing grammar suffers from a tree-sitter bug, which made it unsuitable for implementing parser based indentation in Emacs. This grammar works around that bug.

Additional differences:

  • Doesn't require a custom scanner
  • Covers some more recent syntax additions (parentheticals), and some of the weirder lexical productions
  • Follows the compiler's grammar more closely by implementing parameterized expression productions.
  • ~33% reduction in compiled output size
  • Tested to successfully parse every .mo file in the compiler repository, as well as base

About

tree-sitter grammar for Motoko

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors