Is there any free algorithm to check for C # syntax?

2

I am creating a small text editor that has C # code. Is there any way from within the program itself, regardless, to check if the syntax is correct?

Note: I'm not using C # to do the text editor. I'm just after a syntax algorithm. It can be in any language, it is easy to convert.

My goal is not to find a library that does everything but an open algorithm. It seems to me that something related to BNF can help me.

    
asked by anonymous 24.12.2015 / 15:09

1 answer

4

I'd say there's nothing minimally close to what the .Net Compiler Platform can do. It may seem complex at first glance, but the task you are trying to do is complex. And in fact his API is very easy to use for anyone who has a notion of the subject. It was written to make life easier for those who will produce tools that need to parse C # and VB.Net code in some way. It was written to be very modular, you use only what you need.

Aside from being built with tools such as code editors, it is the only way to ensure that language evolutions are automatically addressed.

You may even find simpler solutions, but they will be very bad. I would not waste time.

Visual Studio is changing all its own code for this solution.

    
24.12.2015 / 15:15