This is kinda how the compiler-stuff in Dark is written.
Everything - the editor, semantic analysis, version control, execution engine, everything - all use the same data structures (the same abstract syntax tree).
We use functional data structure everywhere and we do functional updates within the AST all the time; that's even how text entry in the editor updates the program.
> Everything - the editor, semantic analysis, version control, execution engine, everything - all use the same data structures (the same abstract syntax tree).
Is that data structure suitable for all those purposes though?
How do you do optimisations like GVN on an AS->T<-?
It's not suitable for all purposes, but it's suitable for all editor purposes (including an in-editor execution engine). We don't do GVN, or any optimizations really, right now - I'm sure when we have a compiler of sorts we'll have other structures, SSA, etc.
Everything - the editor, semantic analysis, version control, execution engine, everything - all use the same data structures (the same abstract syntax tree).
We use functional data structure everywhere and we do functional updates within the AST all the time; that's even how text entry in the editor updates the program.