gchpaco / gopprint

Implementation of Kiselyov et al's pretty printing algorithm in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gopprint

An implementation of Kiselyov et al's pretty printing algorithm in Go.

Pretty printing occurs in two global phases. Rather than try to print some random tree directly, which could get quite ugly quite quickly, we build a "pretty printer document" out of some very simple primitives. These primitives (and our algorithm) are due to D.C. Oppen originally and later Kiselyov et al. Oppen's original formulation had Text, LineBreak, Concat, and Group. I generalized LineBreak to cond_t which became our cond_t because we need to do more sophisticated breaks, and I added nest_t for controllable indentation.

About

Implementation of Kiselyov et al's pretty printing algorithm in Go.

License:MIT License


Languages

Language:Go 100.0%