String-parsing in Nix: Difference between revisions

From NixOS Wiki
imported>Milahu
m See also: String parsing in other FP Languages
Klinger (talk | contribs)
mNo edit summary
 
(7 intermediate revisions by one other user not shown)
Line 3: Line 3:
Some string parsers written in Nix
Some string parsers written in Nix


=== yaml ===
=== YAML ===


* https://github.com/DavHau/fromYaml
* https://github.com/DavHau/fromYaml
* https://github.com/arcnmx/nixexprs/blob/master/lib/from-yaml.nix
* https://github.com/arcnmx/nixexprs/blob/master/lib/from-yaml.nix


=== toml ===
=== TOML ===


* https://github.com/mozilla/nixpkgs-mozilla/blob/master/lib/parseTOML.nix
* https://github.com/mozilla/nixpkgs-mozilla/blob/master/lib/parseTOML.nix
=== XML ===
* https://github.com/nprindle/nix-parsec/pull/6
* [https://github.com/NixOS/nixpkgs/issues/57239 fromXML builtin? (nixpkgs#57239)]


=== yarn.lock ===
=== yarn.lock ===
Lockfile for [https://yarnpkg.com/ yarn], a package manager for JavaScript


* https://github.com/nix-community/dream2nix/blob/main/src/subsystems/nodejs/translators/yarn-lock/parser.nix
* 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/nix-community/npmlock2nix/pull/29
* https://github.com/nprindle/nix-parsec/pull/3
=== mix.lock ===
Lockfile for [https://hex.pm/docs/usage mix], a package manager for Erlang
* 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 ===


=== cabal freeze ===
* https://github.com/nprindle/nix-parsec/tree/master/examples/arithmetic


https://github.com/nix-community/dream2nix/blob/main/src/subsystems/haskell/translators/cabal-freeze/parser.nix
=== cabal.project.freeze ===


=== IPv4 addresses ===
Lockfile for [https://cabal.readthedocs.io/en/stable/cabal-commands.html#cabal-freeze cabal], a package manager for Haskell


https://github.com/NixOS/nix/issues/1491#issuecomment-318273971
* https://github.com/nix-community/dream2nix/blob/main/src/subsystems/haskell/translators/cabal-freeze/parser.nix


== Parser generators ==
=== IPv4 address ===


Generate parser from grammar
* https://github.com/NixOS/nix/issues/1491#issuecomment-318273971


* https://github.com/nprindle/nix-parsec
=== 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 complex parsers from many small parsers
 
* 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 ==


* [https://github.com/NixOS/nix/issues/1491 Add an Earley parser builtin (nix#1491)]
* [https://github.com/NixOS/nix/issues/1491 Add an Earley parser builtin (nix#1491)]
* [https://github.com/NixOS/nixpkgs/issues/57239 fromXML builtin? (nixpkgs#57239)]
* [https://github.com/purenix-org/purenix purenix - compile PureScript to Nix]
* String parsing in other Functional Programming Languages
* String parsing in other Functional Programming Languages
** String parsing in Haskell ([https://www.google.com/search?q=String+parsing+in+Haskell google])
** String parsing in Haskell ([https://www.google.com/search?q=String+parsing+in+Haskell google])
** XML parser in pure Haskell ([https://www.google.com/search?q=XML+parser+in+pure+Haskell google])
[[Category:nix]]
[[Category:Development]]

Latest revision as of 20:43, 24 April 2024

String parsers

Some string parsers written in Nix

YAML

TOML

XML

yarn.lock

Lockfile for yarn, a package manager for JavaScript

mix.lock

Lockfile for mix, a package manager for Erlang

Lisp

Arithmetic

cabal.project.freeze

Lockfile for cabal, a package manager for Haskell

IPv4 address

UUID

Linux kernel config

Python setup.cfg

PureScript

Parser combinators

Build complex parsers from many small parsers

Grammars

See also