"Smart" text editor should help with parentheses. Two ideas come to mind:
- It should be aware of S-expression grammar, and actively monitor what the user is typing. (Think of it as an s-expression expert watching over your shoulder).
- The line or code block that the cursor is on at a given time, could swtich to multiline view on the fly, with parentheses replaced with indentations, and some color coding. When you move cursor up using the arrow key, the multiline S-expression automatically collapses, and the one above expands.
In any case, text editors need to be "fully" aware of the language, e.g., even if the editor does syntax highlighting, it is doing that based on the complete parsing cabability of the syntax, instead of just bunch of rules in editor's script (like vimscript in vim).
It would also help if the source file is saved as an AST of the code, instead of raw code. This would also help with code formatting on the fly, and personalized settings for the user of the text editor (e.g., one use always prefers to see S-expressions in multiple lines, another always prefers collapsed view.)
Going further. Text editor should allow you to replace any language token with your favorite token, e.g., '(' and ')' could be replaced with '{' or '}' or something else (or maybe even just indentations). As a user preference, not as something that is saved in the AST file.
I hope to see something like this for C, something that I like to call "semantic C" programming.
I guess I went off on a tangent.