3 ms·
This breakthrough happened already. This is called bidirectional or invertible parsing. See it discussed here https://news.ycombinator.com/item?id=16392654 http
by nextaccountic 6y ago
This breakthrough happened already. This is called bidirectional or invertible parsing. See it discussed here https://news.ycombinator.com/item?id=16392654 https://news.ycombinator.com/item?id=16392654
And this paper https://dl.acm.org/doi/10.1145/1863523.1863525 https://dl.acm.org/doi/10.1145/1863523.1863525 "Invertible syntax descriptions: unifying parsing and pretty printing"
And this Haskell library https://hackage.haskell.org/package/roundtrip https://hackage.haskell.org/package/roundtrip among others