just watched the structural editing talk, I imagine you already have some ideas on how to do that, but in case it helps here's how the comments in alv are handled (where I have to parse into AST and stringify back with zero changes):

- comments are a kind of whitespace
- forms with N elements optionally store N+1 pieces of whitespace strings (before head, between 1 and 2, 2 and 3, ... after N)
- the document itself is an implicit, parenthesis-less "do" form


you could have a flag for the compiler-parser to keep whitespace and use that whitespace rather than auto-generated one if present.

If you keep the raw string for each token/literal, you can also fix the number thing that way if you want. But not having any string backups has a certain purity that might be your goal 😉

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.