Tree-sitter grammar for Eiffel

30 views
Skip to first unread message

Ilgiz Mustafin

unread,
Jun 5, 2024, 2:34:42 AMJun 5
to Eiffel Users
Me and Alessandro Schena have made a tree-sitter parser for Eiffel.

We use it for syntax highlighting, code indentation and for semantic navigation and selection in Emacs and Neovim in rare occasions when only small edits to files are needed.
Tree-sitter grammars are supported by many editors among which are VSCode, Zed and Helix.

Neovim integration is pretty straightforward:
- Download repository
- Run tree-sitter generate
- In the configuration of nvim-treesitter (https://github.com/nvim-treesitter/nvim-treesitter) add
local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
parser_config.eiffel = {
  install_info = {
    url = "<path-to-local-tree-sitter-eiffel-grammar>",
    files = { 'src/parser.c' },
    branch = 'main',
    },
  filetype = 'e'
}
- Start nvim and run :TSInstall eiffel.


Emacs integration is a bit more complicated. I will share what I have a bit later.

rfo amalasoft.com

unread,
Jun 5, 2024, 8:39:12 AMJun 5
to eiffel...@googlegroups.com
For emacs users, Tower Eiffel created an Eiffel mode for emacs lisp, back when the Earth was flat.  I've tweaked my copy a few times since then (it's easy), but it doesn't understand all the newest additions.  It's still very handy for those of us so often accused of being old school, or just old.
R

From: eiffel...@googlegroups.com <eiffel...@googlegroups.com> on behalf of Ilgiz Mustafin <ilgimu...@gmail.com>
Sent: Tuesday, June 4, 2024 5:32 PM
To: Eiffel Users <eiffel...@googlegroups.com>
Subject: [eiffel-users] Tree-sitter grammar for Eiffel
 
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/cfd90b4e-de6d-48d0-a7d8-34204b02f278n%40googlegroups.com.

Ilgiz Mustafin

unread,
Jun 10, 2024, 3:07:36 AMJun 10
to Eiffel Users
I think you are talking about https://github.com/jonhermansen/eiffel-mode. It is a nice mode indeed.

Tree-sitter allows us to implement features without writing regexps in emacs but by using tree-sitter queries. In theory it should be easier to write new features this way.

Here is my tree-based Eiffel mode https://github.com/imustafin/eiffel-ts-mode.

среда, 5 июня 2024 г. в 14:39:12 UTC+2, rfo:
Reply all
Reply to author
Forward
0 new messages