Home Posts Tags Post Search Tag Search

Post 4

Side Project - NimbleParsec

Published on: 2025-03-30 Tags: elixir, Blog, NimbleParsec, Side Project, Libraries
This was a fun little side project. I was tasked with trying to parse some times values without any built in time functions. Using this Lib you can take many different style of date and themes. For the project I was given times like 4am 4:32 3:32am. This made it so I had to deal with many optional entries to the NimbleParsec. It always starts with setting the different "variables" that will be used for the defparsec that will parse the date. I choose digit, hour, minute, ampm. Each one of those need to set the values that could be used. Digit 1..9, hours 12-23 and then 00-09 and ampm "am" "pm." Then we need to send those variables to the defparsec. Using optional, repeat, string and other built-in functions. Great project that was fun to build. Check out https://hexdocs.pm/nimble_parsec/NimbleParsec.html