SMIE is a package that provides a generic navigation and indentation engine. Based on a very simple parser using an operator precedence grammar, it lets major modes extend the sexp-based navigation of Lisp to non-Lisp languages as well as provide a simple to use but reliable auto-indentation.
Operator precedence grammar is a very primitive technology for parsing compared to some of the more common techniques used in compilers. It has the following characteristics: its parsing power is very limited, and it is largely unable to detect syntax errors, but it has the advantage of being algorithmically efficient and able to parse forward just as well as backward. In practice that means that SMIE can use it for indentation based on backward parsing, that it can provide both forward-sexp
and backward-sexp
functionality, and that it will naturally work on syntactically incorrect code without any extra effort. The downside is that it also means that most programming languages cannot be parsed correctly using SMIE, at least not without resorting to some special tricks (see SMIE Tricks).
• SMIE setup: | SMIE setup and features. | |
• Operator Precedence Grammars: | A very simple parsing technique. | |
• SMIE Grammar: | Defining the grammar of a language. | |
• SMIE Lexer: | Defining tokens. | |
• SMIE Tricks: | Working around the parser’s limitations. | |
• SMIE Indentation: | Specifying indentation rules. | |
• SMIE Indentation Helpers: | Helper functions for indentation rules. | |
• SMIE Indentation Example: | Sample indentation rules. | |
• SMIE Customization: | Customizing indentation. |
Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html