| ID | d6532283-3c7a-4eb2-82c0-e4305bee0406 |
|---|---|
| DeertopiaVisibility | public |
Layout
Layouts, inherited from Haskell, are a convenient and flexible basis for whitespace-sensitive syntax. At the core, a production Layout S P parses token S, followed by a sequence of P productions, following a few simple rules:
Each
Pmust be indented further than the leading tokenS.All elements
Pmust be aligned with one another; i.e., everyPis equally indented.Lines indented further than the
Pelements are folded into the preceeding element.
compare & contrast with Python's INDENT/DEDENT tokens
Use in SydML
I decided that SydML will use layouts in the future, only after considering the following pros:
I have Haskellbrain.
For this kind of task, Tree-sitter requires a hand-written lexer in C. As I haven't written any C in ages, I figured it would be fun. }:)