To remove structural information, especially to filter something with an implicit tree structure into a simple sequence of leaves; also tends to imply mapping to flat ASCII.
"This code flattens an expression with parentheses into an equivalent canonical form."