rcl/grammar
Ruud van Asseldonk ed709b5225 Begin writing RCL TextMate grammar
So far inspired by JSON.tmLanguage.json in the VS Code repository, let's
see if we can get it to highlight just a constant and maybe an array.
2025-05-25 12:13:11 +02:00
..
bison Optionally allow a colon after "else" in grammar 2024-07-31 21:46:23 +02:00
pygments Autoformat Python sources, make Mypy happy 2025-03-15 20:54:25 +01:00
rcl.vim Generate the Vim plugin from builtins 2025-03-15 20:43:21 +01:00
tree-sitter-rcl Bump version to 0.8.0 2025-03-02 21:15:33 +01:00
vscode Begin writing RCL TextMate grammar 2025-05-25 12:13:11 +02:00
zed Update Zed extension to latest Tree-sitter grammar 2025-03-02 21:19:41 +01:00
README.md Add documentation about the grammars and testing 2024-08-02 23:12:18 +02:00

Grammars

The grammar directory contains various versions of the RCL grammar, as well as plugins and extensions for editors and other tools to add support for RCL. If you are interested in using those, see the syntax highlighting chapter.

The source of truth for RCL's grammars are the lexer and parser in src/lexer.rs and src/parser.rs. These contain a hand-written lexer and recursive descent parser. The parser produces a concrete syntax tree (CST) and the same parser is shared by the evaluator and autoformatter.

Bison

In bison there is a Bison grammar. It can be compiled to check for errors, but the goal is not to be used directly; the goal is to provide a readable yet precise specification of the grammar, and to act as an aid in designing the grammar, to avoid making ad-hoc decisions in the hand-written parser that are difficult to parse with more general tools.

Tree-sitter

The tree-sitter-rcl directory contains a Tree-sitter grammar that forms the basis of various editor integrations. It has its own chapter.

Editor integrations

The following directories contain editor-specific extensions:

  • rcl.vim
  • vscode
  • zed

See the syntax highlighting chapter for how to use them.