I want to implement another debugger (language) for .NET (it’s just for academic reason, so that it can implement just a part of a language). I myself like to implement NS2 (network Simlator 2) script for .NET in which anybody can write ns2 script and debug it with .NET
I read this article in stackoverflow and it is far from what I’m looking for.
Here is the requirement
- have some predefined keywords (e.g: for, while, if …)
- check the correct form of the statements (e.g: for(start;end;counter){commands} …)
- diffferent colour for different types of statements
- ability to add to any IDE (e.g: implementatin like add-in or as a dll or …(I have no idea))
- many other thing that is not necessary for now
How can I do this?
Update : I’m not sure that you got my point, take a look at this, it is very close to what I am looking for.
It will not be an easy task. However: The Dragon Book is probably a good place to start (assuming you’ve got sufficient computer science background for a compiler theory book to make much sense to you). Compiler Construction: Principles and Practice is also a good text.
You’ll want to compile to CIL (common intermediary language). This handy wiki article outlines the CIL instruction set. Debugging your intermediate code against the CLR… well, that’s where the StackOverflow article you’ve linked will come in handy =)
That’ll cover your first two bullets (and consume a big chunk of your life).
The next two are different issues, but the easiest way to ‘make it go’ would probably be to define a syntax for an existing text editor, and set up a macro in the program to call your compiler. I’d recommend TextPad, though I’m sure opinions on a configurable general-purpose text editor will vary among the community 😉
Designing a full IDE with all of the features you’ve come to know and love in your environment could be quite a task … or you could try to build an eclipse plugin. Personally (assuming you can design your language and learn something from it), I’d just stick with syntax highlighting in TextPad.