Skip to content

jbellerb/tree-sitter-dhall

Repository files navigation

tree-sitter-dhall

Dhall grammar for tree-sitter

Scope

This parser is designed for syntax highlighting and does not strictly follow the Dhall language semantics. My goal is for all valid Dhall expressions to parse to something sensible. An invalid expression parsing is fine, except when it is obviously wrong. To help with this, the output of the parser is checked with hand-written syntax trees for every Dhall successful parse test (current with dhall-lang commit 6d4c9d6) except:

  • unit/ShebangA.dhall, unit/ShebangNixA.dhall: Handled by the text editor.
  • unit/TrailingLineCommentWithoutNewlineA.dhall: Unclear how to test with tree-sitter.

Additionally, these tests serve as a reference for what syntax trees various Dhall expressions produce. A shell script (tests.sh) is provided to check that all tests, excluding a few intentionally non-compliant ones, are included.

References

  • The Dhall Syntax Grammar - Dhall syntax is specified as an ABNF grammar based on RFC 5234.
  • The Dhall Acceptance Tests - Tests provided by the Dhall authors to verify implementation correctness. The binary format parsing tests evaluate to is described here.
  • Dhall Semantics - The complete specification of the dhall language, which all implementations are based on.

License

Copyright (C) jae beller, 2022.
Released under the MIT License. Test scenarios in test/corpus/ are copyright the Dhall authors and reproduced under the BSD-3-Clause License.

About

Dhall grammar for tree-sitter

Topics

Resources

License

MIT, BSD-3-Clause licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
LICENSE.dhall-lang

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •