3 ms·
If you are interested in learning about text (not binary) parsing in Elixir check out the nimbleparsec library: https://hexdocs.pm/nimble_parsec/NimbleParsec.h
by dugmartin 4y ago
If you are interested in learning about text (not binary) parsing in Elixir check out the nimbleparsec library:
https://hexdocs.pm/nimble_parsec/NimbleParsec.html https://hexdocs.pm/nimble_parsec/NimbleParsec.html
I was able to write a very succinct parser for woodworking (using imperial fractions) in around 38 lines of commented code. It parses strings like 0.25 or 2 or 1/4 or 1/4" or 1' 2 3/4" and pops out an integer or float in inches.
I had never used a parser combinator library before but I have written many recursive descent parsers over the years. I was a little surprised when I added the `debug: true` option and saw the shear amount of code it generated. That probably could be reduced by refactoring my combinators.
- geekodour 4y agoi am interested in knowing what is woodworking here
- sceadu 4y agoPretty sure he means literal woodworking... You know, taking measurements, hammering, chiseling...
- dugmartin 4y agoI left out “design” after woodworking. I’m building an online 3D DIY design and instructional app where you can customize plans by entering dimensions in a form (https://plansformer.com/ https://plansformer.com/).