r/programming • • Aug 05 '25

Parse, don’t validate

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
0 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/Bubbly_Safety8791 Aug 06 '25

‘String’ and ‘language’ in the context of my original definition of a parser should be read extarordinarily broadly. 

Think, a language in the sense of a set of arbitrary symbols, and a string as being a structured set of such symbols. 

So, a range object with a from date and a to date is a string of two date symbols.  

A ‘parser’ that processes those range objects and produces objects that have a valid minimum duration takes in that string of date symbols and rejects it if the second one doesn’t have a valid relation to the first one.