4 ms·
Invalid states should only need exist in terms of virtual placeholders for elements required by the grammar, but not filled in by the user. I have a (unsupporte
by gmueckl 8y ago
Invalid states should only need exist in terms of virtual placeholders for elements required by the grammar, but not filled in by the user. I have a (unsupported) suspicion that directly editing a syntax tree when gaps in its structure ate allowed is no more cumbersome than editing the textual representation.
My understanding is that tools like Eclipse and Resharper work on pretty similar models internally to prevent complete failure to understand a code file while it is being mangled by the user.
- Rusky 8y agoYes, but that requires a lot of language-specific work and heuristics to make work, and there are still a lot of places where the approach falls down. (Source: I work on precisely that sort of tool for C++.) So you need the text-based fallback here, and you still need it anyway for the case of editing something a structure the editor doesn't know.
- gmueckl 8y agoC++ is the worst possible language in this case. Its complexity is immense and the C preprocessor layered on top makes a straight mapping between code and syntax tree impossible to achieve in general. Simpler languages like Java or C# (at least relative to C++) allow such syntax tree based tools to reach much, much further. I do believe that it should be possible to build an editor for "nice" languages of that kind that is entirely based on editing the syntax tree.