LionWeb-io / lionweb-typescript

Implements (select parts of) the LionWeb specification, and tooling around that - all in TypeScript.
Apache License 2.0
10 stars 4 forks source link

Consider using AST-based TypeScript code generation #153

Open dslmeinte opened 2 months ago

dslmeinte commented 2 months ago

See e.g.: https://nabeelvalley.co.za/docs/javascript/typescript-ast/

This might also be useful to make pluggable code generators, e.g. generating code specifically for Freon.

Is it possible to use a ParseExpression feature like Roslyn has?

joswarmer commented 2 months ago

At first sight this looks harder than just using a (text) template. But maybe first sight is misleading :-).

dslmeinte commented 1 month ago

(See also: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API#creating-and-printing-a-typescript-ast)

dslmeinte commented 1 month ago

Two advantages of this approach is that we're already using an intermediate representation, and that potentially things like cross-file imports could become a bit easier.