Is there a free algorithm to check syntax C#?

Asked

Viewed 137 times

2

I’m creating a small text editor that has C#code. There is some way inside the program itself, independently, to check if the syntax is correct?

Note: I am not using C# to do the text editor. I am only 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.

  • Will the editor handle C#code? It needs to check C syntax#?

  • Yes that’s right, just C# .

  • After this edition it seems that the question got worse. It is very confusing what you want. Maybe what you want doesn’t exist. Maybe it doesn’t even make sense. Try to clarify.

1 answer

4


I’d say there’s nothing anywhere near that .NET Compiler Platform can do. It may seem complex at first glance, but the task you are wanting to do is complex. And actually his API is pretty easy to use for people who have a sense of the subject. It was written to make life much easier for those who will produce tools that need to analyze C# and VB.NET code in some way. It was written to be well modular, you use only what you need.

In addition to being designed to integrate with tools such as code editors, it is the only way to ensure that language evolutions are automatically contemplated.

You can even find simpler solutions, but they will be very bad. I wouldn’t waste time.

Visual Studio swapped all its own codes for this solution.

  • Who negatively could explain what is wrong with the answer. Do you know anything better than this to use? Post the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.