Skip to content

Tree-sitter for the Jakt Programming Language

License

Notifications You must be signed in to change notification settings

SerenityOS/tree-sitter-jakt

Repository files navigation

Tree-Sitter Jakt

Jakt grammar for tree-sitter

Jakt is a memory safe programming language created for SerenityOS that transpiles to C++.

Roadmap

tree-sitter-jakt implements 100% (330/330) of the Jakt Samples as of February 26, 2023

Screenshot

Screenshots

How to run tests

The tree-sitter cli is required to run tests.

tree-sitter generate && tree-sitter test

Contributing

See the CONTRIBUTING.md.

How to install in Neovim

Note: this step is only temporary. The highlighter will eventually be added to the nvim-tressitter project to be included with neovim.

  1. Add the following to the neovim (lua) config:

    local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
    parser_config.jakt = {
      install_info = {
        url = "https://github.com/demizer/tree-sitter-jakt.git", -- local path or git repo
        files = {"src/parser.c", "src/scanner.c"},
        -- optional entries:
        branch = "main", -- default branch in case of git repo if different from master
        generate_requires_npm = false, -- if stand-alone parser without npm dependencies
        requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
      },
    }
  2. Manually install the highlighter

    See nvim-treesitter instructions

    highlights.scm is contained in the tree-sitter-jakt repository.

    mkdir -p ~/.config/nvim/queries/jakt
    cp queries/* ~/.config/nvim/queries/jakt/
    
  3. Install tree-sitter-jakt using neovim

    :TSInstall jakt
    
  4. checkhealth in neovim

    :checkhealth
    
  5. jakt should be contained in the tree-sitter parsers and should it should have a check under highlight.

  6. Configure filetype detection

    vim.filetype.add { extension = { jakt = "jakt"} }
  7. Open a jakt file