robrix / Madness

Recursive Descent Into Madness
MIT License
291 stars 14 forks source link

Pretty-print grammars #46

Open robrix opened 9 years ago

robrix commented 9 years ago

I don‘t think we can do this with parsers-as-just-functions, but it turns out that the type inferencing is pretty terrible and slow that way anyway, and who knows, maybe parsers-as-recursive-enum would be faster.

Basically, I want to pretty-print grammars such that toString(x ++ y) returns "x ++ y" or "x y".

robrix commented 9 years ago

cf #85.

That’s to do with using a single structure to compose parsers & pretty-printers in unison, but it’d be interesting to see if we could represent the grammar itself as the end result of a parser/source of a pretty-printer.