All Projects → tree-sitter → tree-sitter-haskell

tree-sitter / tree-sitter-haskell

Licence: MIT license
Haskell grammar for tree-sitter.

Programming Languages

javascript
184084 projects - #8 most used programming language
rust
11053 projects
scheme
763 projects
shell
77523 projects
Makefile
30231 projects
swift
15916 projects

Projects that are alternatives of or similar to tree-sitter-haskell

Tree Sitter
An incremental parsing system for programming tools
Stars: ✭ 7,083 (+6339.09%)
Mutual labels:  tree-sitter
tree-sitter-lua
Lua grammar for tree-sitter.
Stars: ✭ 40 (-63.64%)
Mutual labels:  tree-sitter
tree-sitter-comment
Tree-sitter grammar for comment tags like TODO, FIXME(user).
Stars: ✭ 86 (-21.82%)
Mutual labels:  tree-sitter
tree-sitter.el
An Emacs dynamic module exposing tree-sitter.
Stars: ✭ 59 (-46.36%)
Mutual labels:  tree-sitter
swift-tree-sitter
Swift bindings for the tree-sitter parsing library
Stars: ✭ 29 (-73.64%)
Mutual labels:  tree-sitter
tree-sitter-hcl
A tree-sitter grammar for HCL (HashiCorp Configuration Language), used by projects such as Terraform.
Stars: ✭ 65 (-40.91%)
Mutual labels:  tree-sitter
tree-sitter-kotlin
Kotlin grammar for Tree-Sitter
Stars: ✭ 35 (-68.18%)
Mutual labels:  tree-sitter
tree-sitter-elixir
ananthakumaran.in/tree-sitter-elixir
Stars: ✭ 43 (-60.91%)
Mutual labels:  tree-sitter
reason-tree-sitter
ReasonML bindings for tree-sitter
Stars: ✭ 22 (-80%)
Mutual labels:  tree-sitter
tree-sitter-regex
Tree-sitter parser for regular expressions
Stars: ✭ 42 (-61.82%)
Mutual labels:  tree-sitter
tree-sitter-rust
Rust grammar for tree-sitter
Stars: ✭ 199 (+80.91%)
Mutual labels:  tree-sitter
tree-sitter-cli
CLI tool for creating and testing tree-sitter parsers
Stars: ✭ 43 (-60.91%)
Mutual labels:  tree-sitter
tree-sitter-css
CSS grammar for Tree-sitter
Stars: ✭ 57 (-48.18%)
Mutual labels:  tree-sitter
tree-sitter-php
PHP grammar for tree-sitter
Stars: ✭ 83 (-24.55%)
Mutual labels:  tree-sitter
tree-sitter-java
Java grammar for tree-sitter
Stars: ✭ 73 (-33.64%)
Mutual labels:  tree-sitter
difftastic
a syntax-aware diff 🟥🟩
Stars: ✭ 1,701 (+1446.36%)
Mutual labels:  tree-sitter
ltreesitter
Standalone tree sitter bindings for the Lua language
Stars: ✭ 62 (-43.64%)
Mutual labels:  tree-sitter
go-tree-sitter
Golang bindings for tree-sitter https://github.com/tree-sitter/tree-sitter
Stars: ✭ 137 (+24.55%)
Mutual labels:  tree-sitter
awesome-tree-sitter
Curated list of awesome tree-sitter language grammars, bindings, tools, libraries
Stars: ✭ 29 (-73.64%)
Mutual labels:  tree-sitter
kosmikoa.nvim
A dark color scheme for Neovim with support for LSP, Treesitter. This mirror is deprecated. Use the repo at https://sr.ht/~novakane/kosmikoa.nvim/
Stars: ✭ 23 (-79.09%)
Mutual labels:  tree-sitter

tree-sitter-haskell

CI

Haskell grammar for tree-sitter.

References

Building with nvim-treesitter

When installing the grammar from source, be sure to include the scanner in the source files:

lua <<EOF
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.haskell = {
  install_info = {
    url = "~/path/to/tree-sitter-haskell",
    files = {"src/parser.c", "src/scanner.c"}
  }
}
EOF

Supported Language Extensions

These extensions are supported , unsupported or not applicable because they don't involve parsing ➖️:

  • AllowAmbiguousTypes ➖️
  • ApplicativeDo ➖️
  • Arrows
  • BangPatterns
  • BinaryLiterals
  • BlockArguments
  • CApiFFI
  • ConstrainedClassMethods
  • ConstraintKinds
  • CPP
  • CUSKs
  • DataKinds
  • DatatypeContexts
  • DefaultSignatures
  • DeriveAnyClass ➖️
  • DeriveDataTypeable ➖️
  • DeriveFoldable ➖️
  • DeriveFunctor ➖️
  • DeriveGeneric ➖️
  • DeriveLift ➖️
  • DeriveTraversable ➖️
  • DerivingStrategies
  • DerivingVia
  • DisambiguateRecordFields ➖️
  • DuplicateRecordFields ➖️
  • EmptyCase
  • EmptyDataDecls
  • EmptyDataDeriving
  • ExistentialQuantification
  • ExplicitForAll
  • ExplicitNamespaces
  • ExtendedDefaultRules ➖️
  • FlexibleContexts
  • FlexibleInstances
  • ForeignFunctionInterface
  • FunctionalDependencies
  • GADTs
  • GADTSyntax
  • GeneralisedNewtypeDeriving ➖️
  • GHCForeignImportPrim
  • Haskell2010 ➖️
  • Haskell98 ➖️
  • HexFloatLiterals
  • ImplicitParams
  • ImplicitPrelude ➖️
  • ImportQualifiedPost
  • ImpredicativeTypes ➖️
  • IncoherentInstances ➖️
  • InstanceSigs
  • InterruptibleFFI
  • KindSignatures
  • LambdaCase
  • LexicalNegation
  • LiberalTypeSynonyms
  • LinearTypes
  • MagicHash
  • Modifiers
  • MonadComprehensions ➖️
  • MonadFailDesugaring ➖️
  • MonoLocalBinds ➖️
  • MonomorphismRestriction ➖️
  • MultiParamTypeClasses
  • MultiWayIf
  • NamedFieldPuns
  • NamedWildCards
  • NegativeLiterals ➖️
  • NondecreasingIndentation
  • NPlusKPatterns ➖️
  • NullaryTypeClasses
  • NumDecimals ➖️
  • NumericUnderscores
  • OverlappingInstances ➖️
  • OverloadedLabels
  • OverloadedLists ➖️
  • OverloadedStrings ➖️
  • PackageImports
  • ParallelListComp
  • PartialTypeSignatures
  • PatternGuards
  • PatternSynonyms
  • PolyKinds ➖️
  • PostfixOperators ➖️
  • QualifiedDo
  • QuantifiedConstraints
  • QuasiQuotes
  • Rank2Types
  • RankNTypes
  • RebindableSyntax ➖️
  • RecordWildCards ➖️
  • RecursiveDo
  • RoleAnnotations
  • Safe ➖️
  • ScopedTypeVariables
  • StandaloneDeriving
  • StandaloneKindSignatures
  • StarIsType
  • StaticPointers
  • Strict ➖️
  • StrictData ➖️
  • TemplateHaskell
  • TemplateHaskellQuotes
  • TraditionalRecordSyntax ➖️
  • TransformListComp
  • Trustworthy ➖️
  • TupleSections
  • TypeApplications
  • TypeFamilies
  • TypeFamilyDependencies
  • TypeInType
  • TypeOperators
  • TypeSynonymInstances ➖️
  • UnboxedSums
  • UnboxedTuples
  • UndecidableInstances ➖️
  • UndecidableSuperClasses ➖️
  • UnicodeSyntax
  • UnliftedFFITypes ➖️
  • UnliftedNewtypes
  • Unsafe ➖️
  • ViewPatterns

Bugs

CPP

Preprocessor #elif and #else directives cannot be handled correctly, since the parser state would have to be manually reset to what it was at the #if. As a workaround, the code blocks in the alternative branches are parsed as part of the directives.

Layout

NondecreasingIndentation is not supported (yet?).

Operators on newlines in do

A strange edge case is when an infix operator follows an expression statement of a do block with an indent of less or equal the do's layout column:

f = do
  readSomething
  >>= doSomething

The >>= causes the do's layout to be terminated, resulting in an AST similar to

f = (do readSomething) >>= doSomething

This is checked heuristically, probably unreliably.

Testing

Requires: tree-sitter(-cli)

Run test corpus

These are stored in ./tests/corpus/

$ tree-sitter test

Test parsing an example codebase

Requires: bc
This will print the percentage of the codebase parsed, and the time taken

$ ./script/parse-examples             # this clones all repos
$ ./script/parse-example <example>    # where <example> is a project under ./examples/

Enable scanner debug output

To get an extra-verbose scanner, unoptimized, with debug symbols:

$ CFLAGS='-DDEBUG' make debug.so
$ cp debug.so $HOME/.cache/tree-sitter/lib/haskell.so    # So `tree-sitter-cli` uses our binary
$ tree-sitter test
$ ./script/parse-example <example>

If you want to debug the scanner with gdb, you can b tree_sitter_haskell_external_scanner_scan with tree-sitter test.

Create visual graph of parser steps

Requires: graphviz

$ tree-sitter parse -D test/Basic.hs    # Produces log.html
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].