rust-langdev VS nom

Compare rust-langdev vs nom and see what are their differences.

rust-langdev

Language development libraries for Rust (by Kixiron)

nom

Rust parser combinator framework (by Geal)
Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • Scout APM - Truly a developer’s best friend
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Zigi - Delete the most useless function ever: context switching.
rust-langdev nom
9 63
630 7,287
- -
3.5 5.6
8 days ago 7 days ago
Rust
The Unlicense MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

rust-langdev

Posts with mentions or reviews of rust-langdev. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-15.

nom

Posts with mentions or reviews of nom. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-26.
  • Am I the only one who struggles mainly with parsing the input?
    6 projects | reddit.com/r/adventofcode | 26 Nov 2022
  • Hey Rustaceans! Got a question? Ask here! (47/2022)!
    10 projects | reddit.com/r/rust | 21 Nov 2022
    https://github.com/Geal/nom According to its readme, it can work without std (though I wonder why you'd want that).
  • Help with packet sniffing and parsing in rust
    4 projects | reddit.com/r/rust | 2 Oct 2022
    I can not find, the original project, or example, so here is mine: https://github.com/sleepy771/rustacap/blob/master/src/main.rs (it probably does not work, because each of the libraries used has evovlved). Basically it caputred packets on interface using pcap (libpcap) and then parsed them using nom.
  • Thoughts on reimplementing an old MIDI scripting language in rust.
    3 projects | reddit.com/r/rust | 27 Aug 2022
    Maybe Pest or Nom for parsing the language.
  • Svelte Compiler Rewritten in Rust
    8 projects | news.ycombinator.com | 23 Aug 2022
    Yes, most of the .rs files in https://github.com/pintariching/rustle/blob/main/src/compile... are empty. I was looking as I've been using the nom [0] parser combinator create to build an experimental compiler and I'm curious to see how other Rust compiler projects are doing parsing.

    [0] https://github.com/Geal/nom

  • Chumsky, a Rust parser-combinator library with error recovery
    8 projects | news.ycombinator.com | 8 Jul 2022
    Caveats: I've used nom in anger, chumsky hardly at all, and tree-sitter only for prototyping. I'm using it for parsing a DSL, essentially a small programming language.

    The essential difference between nom/chomsky and tree-sitter is that the former are libraries for constructing parsers out of smaller parsers, whereas tree-sitter takes a grammar specification and produces a parser. This may seem small at first, but is a massive difference in practice.

    As far as ergonomics go, that's a rather subjective question. On the surface, the parser combinator libraries seem easier to use. They integrate well with the the host language, so you can stay in the same environment. But this comes with a caveat: parser combinators are a functional programming pattern, and Rust is only kind of a functional language, if you treat it juuuuust right. This will make itself known when your program isn't quite right; I've seen type errors that take up an entire terminal window or more. It's also very difficult to decompose a parser into functions. In the best case, you need to write your functions to be generic over type constraints that are subtle and hard to write. (again, if you get this wrong, the errors are overwhelming) I often give up and just copy the code. I have at times believed that some of these types are impossible to write down in a program (and can only exist in the type inferencer), but I don't know if that's actually true.

    deep breath

    Tree-sitter's user interface is rather different. You write your grammar in a javascript internal dsl, which gets run and produces a json file, and then a code generator reads that and produces C source code (I think the codegen is now written in rust). This is a much more roundabout way of getting to a parser, but it's worth it because: (1) tree-sitter was designed for parsing programming languages while nom very clearly was not, and (2) the parsers it generates are REALLY GOOD. Tree-sitter knows operator precedence, where nom cannot do this natively (there's a PR open for the next version: https://github.com/Geal/nom/pull/1362) Tree-sitter's parsing algorithm (GLR) is tolerant to recursion patterns that will send a parser combinator library off into the weeds, unless it uses special transformations to accommodate them.

    It might sound like I'm shitting on nom here, but that's not the goal. It's a fantastic piece of work, and I've gotten a lot of value from it. But it's not for parsing programming languages. Reach for nom when you want to parse a binary file or protocol.

    As for chumsky: the fact that it's a parser combinator library in Rust means that it's going to be subject to a lot of the same issues as nom, fundamentally. That's why I'm targeting tree-sitter next.

    There's no reason tree-sitter grammars couldn't be written in an internal DSL, perhaps in parser-combinator style (https://github.com/engelberg/instaparse does this). That could smooth over a lot of the rough edges.

  • How to read binary files from the end in Rust?
    3 projects | reddit.com/r/rust | 4 Jul 2022
    Nom is the most popular. (Creates)
  • Compiler in Rust
    3 projects | reddit.com/r/rust | 29 May 2022
    Although, u/Lisoph I think you may want to also have nom (https://crates.io/crates/nom) on your radar as being a binary codec is nom's first class usecase.
  • how to make a lsp in rust ?
    8 projects | reddit.com/r/rust | 20 May 2022
    Mine all use [tower-lsp](https://github.com/ebkalderon/tower-lsp/) for the LSP protocol stuff, and then either [Tree-sitter](https://github.com/tree-sitter/tree-sitter) or [Nom](https://github.com/Geal/nom). If I do another I'll probably try [Chumsky](https://github.com/zesterer/chumsky) which combines some of the advantages of both.
  • Question about a rust rule
    2 projects | reddit.com/r/rust | 2 May 2022
    In which case I'd suggest using nom

What are some alternatives?

When comparing rust-langdev and nom you can also consider the following projects:

pest - The Elegant Parser

combine - A parser combinator library for Rust

lalrpop - LR(1) parser generator for Rust

rust-peg - Parsing Expression Grammar (PEG) parser generator for Rust

pom - PEG parser combinators using operator overloading without macros.

chumsky - A parser library for humans with powerful error recovery.

chomp - A fast monadic-style parser combinator designed to work on stable Rust.

inkwell - It's a New Kind of Wrapper for Exposing LLVM (Safely)

serde - Serialization framework for Rust

rust-csv - A CSV parser for Rust, with Serde support.

zero - A Rust library for zero-allocation parsing of binary data.

git-journal - The Git Commit Message and Changelog Generation Framework :book: