tag:blogger.com,1999:blog-1777990983847811806.post5829187892816107059..comments2024-03-16T16:29:29.582-07:00Comments on Haskell for all: Pretty-print syntax trees with this one simple trickGabriella Gonzalezhttp://www.blogger.com/profile/01917800488530923694noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-1777990983847811806.post-24950328464231526762020-11-15T20:45:06.639-08:002020-11-15T20:45:06.639-08:00Most happy parsers use operator precedence declara...Most happy parsers use operator precedence declarations to simplify expression parsing, i.e., those that involve usual arithmetic operations. Is there a way to "extend" this trick to cover those cases as well? After all, I believe that's the major source of the need for parens in the first place. Levent Erkokhttps://www.blogger.com/profile/01385670245470349241noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-40264214223695606592020-11-14T20:27:47.942-08:002020-11-14T20:27:47.942-08:00Arguably a BNF grammar encodes all the ways of gen...Arguably a BNF grammar encodes all the ways of generating strings in a given language. So, in a way it is unsurprising that you can construct a string of a language given the proof (i.e. the parse tree) -- and that the generator is fairly mechanically derivable from the BNF.Harihttps://www.blogger.com/profile/12687502458749931117noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-86632972227753855902020-11-12T07:16:52.306-08:002020-11-12T07:16:52.306-08:00I remember this trick being in Pierce's types ...I remember this trick being in Pierce's types and programming language, but I'm not sure that's where it is first used. I've been bit by the looping pretty printer a few times, too — it really is annoying!bruno cuconatohttps://www.blogger.com/profile/10802941951043646832noreply@blogger.com