A repo which serves as a learning ground for the Nom crate.

Related tags

Parsing rust nom
Overview

Fun with Nom

This repo is created as a learning resource for the Nom crate for Rust. Nom is a parser combinators library. It can be used to parse just about anything, text, binary, whatever.

Right now, there isn't much to this project, but it will grow over time. I've spent the last week deep diving into this crate, mostly due to the desire to solve Day 6 of the Shuttle Christmas Code Hunt challenge (now called Shuttlings)

Concepts

Coming Soon...

Where I'm At

I understand how to compose the simple building block parsers.

Challenges to Overcome

I'm beginning to understand combinators. There is now a /count endpoint which accepts a plain text string of any length. The endpoint responds with the word count. Nom is leveraged here via calling a parser which returns the text input as a vector of words. The .len() method is then called to get the word count.

Nom Resources

I feel I've "reached the end of the internet" on what folks have written about regarding this crate. There just isn't that much out there. You have to be careful because much of the content is outdated. Better articles are:

Hand Crafting a Parser

It's worth knowing how to do this. I'm all hot to trot about Nom, but I think a good chunk of the issues I'm having stem from not knowing the basics.

You might also like...
Operator is a web server. You provide a directory and Operator serves it over HTTP.
Operator is a web server. You provide a directory and Operator serves it over HTTP.

Operator Operator is a web server. You provide a directory and Operator serves it over HTTP. It serves static files the way you'd expect, but it can a

This repository serves as the backend for the Torrust Index project.
This repository serves as the backend for the Torrust Index project.

Torrust Index Backend 📢 Important Updates 📢 None at the moment ACCESS ALL UPDATES Index PROJECT DESCRIPTION PROJECT ROADMAP DOCUMENTATION INSTALLATI

Extract data from helium-programs via Solana RPC and serves it via HTTP

hnt-explorer This application extracts data from helium-programs via Solana RPC and serves it via HTTP. There are CLI commands meant to run and test t

A repo for learning rust

learnrust A repo for learning rust Topics: print basic print function. datatypes get to know what is datatypes. variables variables!!!. consts consts

Practice repo for learning Rust. Currently going through "Rust for JavaScript Developers" course.

rust-practice 🦀 Practice repo for learning Rust. Directories /rust-for-js-dev Files directed towards "Rust for JavaScript Developers" course. Thank y

A repo to store all my 6-Month Rust learning steps

RustLearn A repo to store all my 6-Month Rust learning steps. (free time only!) at the end of the 6-month course, the repo will be a rust package for

A repo for learning how to parallelize computations in the GPU using Apple's Metal, in Rust.

Metal playground in rust Made for learning how to parallelize computations in the GPU using Apple's Metal, in Rust, via the metal crate. Overview The

Rust experiments involving Haskell-esque do notation, state, failure and Nom parsers!

Introduction As a long time Haskell developer recently delving into Rust, something I've really missed is monads and do notation. One thing monadic do

a nom parser combinator that matches a psql statement.

psql_splitter a nom parser combinator that matches a psql statement. Postgres has a dialect of SQL that I'm going to call pgsql. Postgres also has a c

Tutorial for parsing with nom 5.

Nom Tutorial Nom is a wonderful parser combinators library written in Rust. It can handle binary and text files. Consider it where you would otherwise

A procedural macro for defining nom combinators in simple DSL

A procedural macro for defining nom combinators in simple DSL

Example of using nom parsers from a proc macro

Example of using nom parsers from a proc macro This project is organised as 3 crates: nom_macro is the main project, exposing the proc macro and the g

Command-line DNS client using bitvec, nom and RFC 1035

Dingo Domain INformation Gatherer, Obviously. Installation Install cargo, see instructions on the Rust website Run ./install.sh (it just does cargo bu

nombytes is a library that provides a wrapper for the bytes::Bytes byte container for use with nom.

NomBytes nombytes is a library that provides a wrapper for the bytes::Bytes byte container for use with nom. I originally made this so that I could ha

Lua bytecode parser written in Rust using nom, part of metaworm's lua decompiler

luac-parser (中文) lua字节码解析器, 目前支持 lua51, lua53, lua54 这是目前效果最好的lua反编译器 metaworm's luadec 的一部分 可以基于此代码定制你所需的lua字节码解析器,编译成WASM,让metaworm's luadec加载使用,来反编

A SQL query parser written using nom.

sqlparser-nom A SQL query parser written using nom. Query Select From Where Order by Limit CTE Group by Having Aggregate Window Pratt Parsing Friendly

📦  Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate.
📦 Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate.

📦 Crate Protocol Crate Protocol allows anyone to create, manage, and trade a tokenized basket of assets, which we refer to as a Crate. A Crate is alw

A fork of the abandoned ffmpeg-next crate which is a fork of the abandoned ffmpeg crate

This is a fork of the abandoned ffmpeg-next crate which is a fork of the abandoned ffmpeg crate. Currently supported FFmpeg versions: 4.x, 5.x. Build

An embedded key-value storage for learning purpose, which is based on the idea of SSTable / LSM-tree.

Nouzdb An embedded key-value storage for learning purpose, which is based on the idea of SSTable / LSM-tree. Plan Implement a memtable. Implement the

Comments
  • improvement: finish /count endpoint and associated parser

    improvement: finish /count endpoint and associated parser

    The /count endpoint is now complete. It demonstrates use of the separated_pair Nom combinator, which breaks the words of a sentence apart and saves them in a vector, the length of which gives the word count.

    opened by sentinel1909 0
  • improvement: add count endpoint

    improvement: add count endpoint

    Added a /count endpoint, which will eventually take a plain text input, invoke a parsing function, and return the word count. Right now the /count endpoint accepts plain text input and echos it back in JSON format.

    opened by sentinel1909 0
Releases(v0.4.0)
  • v0.4.0(Feb 20, 2024)

    Changelog:

    • remove unwrap from parse function in /count endpoint
    • the nom::Error that comes off is mapped to an Actix Web internal server error and sent as a 500 Internal Server Error HTTP response
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Feb 19, 2024)

    Changelog:

    • added parser crate which demonstrates building up a simple parser/combinator function
    • completed the /count endpoint such that it returns the word count of a plain text request body
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Feb 18, 2024)

  • v0.1.0(Feb 18, 2024)

Owner
Jeff Mitchell
Self-taught developer, all-around IT generalist and junkie.
Jeff Mitchell
Example of using nom parsers from a proc macro

Example of using nom parsers from a proc macro This project is organised as 3 crates: nom_macro is the main project, exposing the proc macro and the g

Geoffroy Couprie 1 Mar 20, 2022
This shows proof-of-concept implementation of lexer-parser-evaluator which allows setting custom values to keywords.

Custom Configurable Lexer-Parser Note This is still very experimental, and for any syntax error it will just panic giving very unhelpful error message

null 3 Sep 18, 2021
A friendly parser combinator crate

Chumsky A friendly parser combinator crate that makes writing LL-1 parsers with error recovery easy. Example Here follows a Brainfuck parser. See exam

Joshua Barretto 2.4k Jan 8, 2023
This crate provide parsing fontconfig file but not yet complete all features

This crate provide parsing fontconfig file but not yet complete all features

null 4 Dec 27, 2022
A Rust crate for RDF parsing and inferencing.

RDF-rs This crate provides the tools necessary to parse RDF graphs. It currently contains a full (with very few exceptions) Turtle parser that can par

null 2 May 29, 2022
A Rust crate for LL(k) parser combinators.

oni-comb-rs (鬼昆布,おにこんぶ) A Rust crate for LL(k) parser combinators. Main project oni-comb-parser-rs Sub projects The following is projects implemented

Junichi Kato 24 Nov 3, 2022
A Rust crate for hassle-free Corosync's configuration file parsing

corosync-config-parser A Rust crate for hassle-free Corosync's configuration file parsing. Inspired by Kilobyte22/config-parser. Usage extern crate co

Alessio Biancalana 2 Jun 10, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
An app which reads data from a serial port and serves it on a TCP port.

serial-to-tcp An app which reads data from a serial port and serves it on a TCP port. How to use Clone this repo and build the app as outlined below (

Mr. E 3 Oct 21, 2022
A Rust Operating System, written from the ground up

ThornOS A Rust Operating System, written from the ground up Build Dependencies Bootimage TODO: Document build process in more detail Acknowledgements

Stuart Reid 1 Mar 31, 2022