How to write another debugger for .NET using the CLR

I want to implement another debugger (language) for .NET (it is just for academic reasons, so that it can only implement part of the language). I myself wanted to implement NS2 (network Simlator 2) script for .NET in which anybody can write ns2 script and debug it with .NET

I have read https://stackoverflow.com/a/464944/ and this is far from what I am looking for.

Here is the requirement

  • have certain predefined keywords (for example: for, while, if ...)
  • check the correctness of the form of instructions (for example: for (start; end; counter) {commands} ...)
  • difffferent color for various types of operators
  • the ability to add to any IDE (for example: implementation as an add-in or as a DLL or ... (I have no idea))
  • many other things that are not needed now

How can i do this?

Update: I'm not sure what you understand, this , it is very close to what I'm looking for.

+4
source share
2 answers

It will not be an easy task. However: The Dragon Book is probably a good place to start (assuming you have enough background information for a compiler theory book to make sense to you). Compiler Design: Principles and Practice is also good text.

You want to compile CIL (common intermediary language). This handy wiki article describes a set of CIL instructions. Debugging your middleware from the CLR ... well, where is the related StackOverflow article useful =)

This will cover your first two bullets (and consume a large chunk of your life).

The following two are different problems, but the easiest way to “do this” is probably to determine the syntax of an existing text editor and configure the macro in the program to call your compiler. I would recommend TextPad , although I'm sure that opinions about a general purpose custom text editor will vary among the community;)

Designing a complete IDE with all the features that you have learned and love in your environment can be quite a challenge ... or you can try creating an eclipse plugin. Personally (assuming you can design your language and learn something from it), I just stick with the syntax highlighting in TextPad.

+5
source

This area is becoming more and more interesting, and in fact there is an active Microsoft Research project that is considering this in building a common infrastructure for creating a compiler (and debugger) for custom languages ​​designed for .NET.

http://cciast.codeplex.com/

I myself used the infrastructure, but not an expert in compiler technology. Hopefully this will give you a good starting point, and you might find the discussion forum useful for sharing ideas with like-minded people.

+1
source

All Articles