By supporting immutable trees as output from the parser, it would be easier to create a generalized framework for concrete syntax transformations in the trees. The factory described in #1 would simplify the creation of new trees during the transformation process.
These trees would also simplify the implementation of an incremental lexer and/or parser, which is capable of efficiently creating a complete new parse tree following changes to a subset of the input sequence.
The .NET Compiler Platform is using a similar technique with great success.
By supporting immutable trees as output from the parser, it would be easier to create a generalized framework for concrete syntax transformations in the trees. The factory described in #1 would simplify the creation of new trees during the transformation process.
These trees would also simplify the implementation of an incremental lexer and/or parser, which is capable of efficiently creating a complete new parse tree following changes to a subset of the input sequence.
The .NET Compiler Platform is using a similar technique with great success.