Re:Parser generators vs. handwritten parsers: surveying majo...
by fjfaase on Saturday August 21, 2021 @03:43PM
(#28259923)
I implemented an unparse function in IParse, which is not a parser generator, but a parser that interprets a grammar. See for example https://github.com/FransFaase/IParse/blob/master/software/c_... where symbols starting with a back slash are a kind of white space terminals during the unparse. For example, \inc stands for incrementing the indentation where \dec decrements it. The \s is used to indicate that at given location a space should be included.
Re:Parser generators vs. handwritten parsers: surveying majo...
by jwlato on Saturday August 21, 2021 @10:53PM
(#28262467)
Have you seen BNFC (http://bnfc.digitalgrammars.com/)? I've used it with the Haskell bindings and really appreciated it. Parser, pretty-printer, and AST skeleton all auto-generated. I've only used it with Haskell though, can't speak to the other languages.
Re:Parser generators vs. handwritten parsers: surveying majo...
by mbrodersen on Sunday August 22, 2021 @10:14PM
(#28271685)
Somebody unfortunately chose to use ANTLR on a project I am now maintaining. ANTLR is really really bad. Run don’t walk away.
A killer feature for a parser generator would be the ability to auto-generate a pretty printer which requires stuffing comments into the tree as a "meta token".