Hacker News new | ask | show | jobs
by jbangert 3975 days ago
Before I moved down to MIT, I studied with Sergey, so the name is not at all coincidental. Nail tries a slightly different agenda. Instead of trying to make people design their formats in a reasonable way (which is excellent in the long term), Nail tries to allow people to get some (maybe most) of the benefits of parser generators, but for arbitrary formats.

I also made some different design decisions than Hammer, giving it a slightly different goal: code generation instead of runtime combinators, output generation, no semantic actions...

1 comments

Would you consider using Nail to not just parse content-formats like JSON, but (dependent/semantic) type validation on the values of the data itself. Some of this involves business logic as well. For example, let's say I encode some data in JSON. Well I can parse JSON well, but then I need something inside that JSON to be an integer. Ok, that's fairly easy. But then I need that integer to be between 10 and 20. Ok, we have a filter now. But then, I need that integer to be less than or equal to a value defined elsewhere, but only if that value exists, because it's optional. And then, finally if a certain business condition is not met (by contacting the database), the entire input must be considered invalid and discarded. All of this is a form of data validation, but it increasingly involves more and more complexity.