rcl/grammar
Ruud van Asseldonk d6a4b48bee Point Zed extension at the newly published grammar
This is a bit annoying now, I have to dump them one by one and update
the repository url. But the format forces that. I could automate it
further, but for now it's okay to do by hand.
2024-08-02 23:20:28 +02:00
..
bison Optionally allow a colon after "else" in grammar 2024-07-31 21:46:23 +02:00
pygments Add documentation about the grammars and testing 2024-08-02 23:12:18 +02:00
rcl.vim Add List.sum and Set.sum methods 2024-07-12 23:10:11 +02:00
tree-sitter-rcl Optionally allow a colon after "else" in grammar 2024-07-31 21:46:23 +02:00
zed Point Zed extension at the newly published grammar 2024-08-02 23:20:28 +02: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
  • zed

See the syntax highlighting chapter for how to use them.