Examples of Nemerle to generate c# code like T4 does

440 views Asked by At

I like Nemerle's macro syntax much better than T4. Are there any examples or is it possible to use Nemerle to generate c# code that is then used by the actual Microsoft c# compiler for input in a similar way to T4. Thanks.

3

There are 3 answers

2
Don Reba On

Nemerle macros do not generate code, but rather modify the abstract syntax tree of the program as it is being compiled. However, the Nemerle compiler can read C#, and you can even use Nemerle macros in those C# files.

1
user299771 On

Create a Nemerle to C# prettyprinter is possible. But, the generated code will be ugly (not readable).

0
user2134637 On

I know this answer is irrelevant but there is a Nemerle to Javascript compiler NemerleWeb

Similar methodology can be used to generate C# files.