#parse — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #parse, aggregated by home.social.
-
"Parse, don't validate" through the years with C++
https://derekrodriguez.dev/parse-dont-validate-through-the-years-with-c-/
#HackerNews #Parse #C++ #programming #software #development #coding #bestpractices
-
Parse, Don't Validate and Type-Driven Design in Rust
https://www.harudagondi.space/blog/parse-dont-validate-and-type-driven-design-in-rust/
-
I'm trying to #parse a string into an int in an #esphome lambda. I can use std::stoi() and it works, but I'm struggling at error management. It raises an #exception if the string is not parseable (i.e. "text" instead of "2"), but ESPHome disables the exceptions, so I can't simply try-catch it...
ATM the code is mostly working, but if the string isn't a valid int, the entire device crashes D:
How am I supposed to implement this? -
Context free grammars (CFG) are better than parsing expression grammars (PEG), because CFGs represent how we think.
Parser combinators are similar to PEGs, so they are worse than CFGs, too.
So, don't use Rust libraries
nom,combine. Uselalrpop.Don't use Haskell libraries
parsec,gigaparsec,attoparsec,megaparsec,trifecta. UseEarley,happy.See more detailed story in my new article https://safinaskar.writeas.com/this-is-why-you-should-never-use-parser-combinators-and-peg .
The story also includes some cases, where PEG and parser combinators may still be useful. Also, the article gives links to my Haskell parsing libraries.
#haskell #rust #parsing #parse #cfg #peg #combinators #parsercombinators #parsingcombinators #nom #combine #lalrpop #parsec #earley #happy
-
Epsilon is sometimes represented in #POBNF (Plain Old #BNF) as the Greek letter
itselff, the letter 'E' or 'e' or sometimes as '...' Different
BNF authors write it according to their own internal rules, apparently.
The fact of the symbol in BNF shows the rather tight coupling between a #grammar
notation and the underlying finite state machine tech used to actually #parse
the strings in the #language. Really, it is just multiple states returned from the delta function. #NFA #PDA #DFA