0

I know I can use esprima to get AST for a given JavaScript file/code.

But I can't find a library, or a way to get the AST for C# code.

How can I get that?

Update: I work on Linux. I don't have access to Visual Studio. I use VS Code. Most of my coding is done inside a docker container.

Hasan
  • 19
  • 2
  • @ɐsɹǝʌǝɔıʌ that question is for 14 years ago. Do you really think that nothing has changed in C# since then? Come on. – Hasan Aug 28 '23 at 12:48
  • Roslyn and Antlr4 are two examples that come to mind, but both can be quite heavy to use. What do you want to do with the AST? Roslyn is from Microsoft, you'll find doc online. Antlr is open source, see for instance https://tomassetti.me/getting-started-with-antlr-in-csharp/ – d-markey Aug 28 '23 at 12:54
  • Basis for compilers have not changed in years. If you're looking for a library reccomendation stackoverflow isn't the place for this; you might just start looking into github.com – Some random IT boy Aug 28 '23 at 13:02
  • @Hasan and do you really think it cannot parse current C# code by using the latest assembly? Come on. – ɐsɹǝʌ ǝɔıʌ Aug 28 '23 at 13:15
  • Without further ado I would stick to Roslyn. – Mustafa Özçetin Aug 28 '23 at 13:21

0 Answers0