Yesterday I wanted to parse something like this:
alpha
beta
gamma
delta
epsilon
zeta
And end up with an AST nested like this: (alpha(beta, gamma), delta(epsilon(zeta)))
. The actual type of the AST could be just a list of lists of strings, or actual Node
objects; it's all isomorphic. That is, the AST contains exactly the same hierarchy as the text. Assume for simplicity that we want to hardcode indentation as being two spaces.