String-parsing in Nix: Difference between revisions
imported>Milahu update: Parser combinators |
imported>Milahu add section: Grammars |
||
Line 56: | Line 56: | ||
* https://github.com/nprindle/nix-parsec - API is similar to [https://github.com/mrkkrp/megaparsec megaparsec] in Haskell | * https://github.com/nprindle/nix-parsec - API is similar to [https://github.com/mrkkrp/megaparsec megaparsec] in Haskell | ||
=== Grammars === | |||
* antlr https://github.com/antlr/grammars-v4 | |||
* tree-sitter https://github.com/search?q=tree-sitter+grammar | |||
== See also == | == See also == |
Revision as of 19:29, 17 November 2022
String parsers
Some string parsers written in Nix
yaml
toml
yarn.lock
- https://github.com/nix-community/dream2nix/blob/main/src/subsystems/nodejs/translators/yarn-lock/parser.nix
- https://github.com/nix-community/npmlock2nix/pull/29
- https://github.com/nprindle/nix-parsec/pull/3
Lisp
- https://github.com/utdemir/nixlisp/blob/main/nix/parser.nix
- https://github.com/nprindle/nix-parsec/pull/4
arithmetic
https://github.com/nprindle/nix-parsec/tree/master/examples/arithmetic
cabal freeze
IPv4 addresses
https://github.com/NixOS/nix/issues/1491#issuecomment-318273971
UUID
https://github.com/nprindle/nix-parsec/tree/master/examples/uuids
Linux kernel config
https://github.com/nprindle/nix-parsec/tree/master/examples/kernel-config
Python setup.cfg
https://github.com/seppeljordan/nix-setuptools/blob/master/lib/setuptools.nix
PureScript
https://github.com/purs-nix/purs-nix/blob/master/parser.nix
Parser combinators
Build parsers from grammars
- https://github.com/nprindle/nix-parsec - API is similar to megaparsec in Haskell
Grammars
- antlr https://github.com/antlr/grammars-v4
- tree-sitter https://github.com/search?q=tree-sitter+grammar
See also
- Add an Earley parser builtin (nix#1491)
- fromXML builtin? (nixpkgs#57239)
- purenix - compile PureScript to Nix
- String parsing in other Functional Programming Languages