It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
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.
There is more and more interest in this area and in fact there is an active project by Microsoft Research that is looking at this on building a common infrastructure to build compiler (and debugger) for custom languages targetting .NET
http://cciast.codeplex.com/
I have used the infrastructure myself but not an expert in compiler technology. Hope this gives you a good starting point and you may find the discussion forum useful to share idea with like minded people.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
If so, how can i protect my code from being decompiled?
Or from being reflected? If actually the two are very different from each other.
Tools like Dotfuscator for the .Net framework, do they help your code from being decompiled? Does that mean that i can still reflect on it and see it's contents??
You can't ever stop either. You can make it so that decompiling the program returns incomprehensible and confusing code, but it still will be valid code that results in a program that functions identically to yours. Making subtle changes will be harder, but not impossible. Doing that is called obfuscation, which is what those tools are.
Obfuscators go around doing things like changing all variable names to meaningless alphanumeric values, performing all sorts of code refactors that don't change how the code works, but just are things that do the same thing in a different way (and is somehow harder for humans to understand, but not computers). They can also add in code that doesn't do anything, just to confuse people, etc. Different obfuscators will do all sorts of different things, and they can have some differences such as, whether or not they accidentally introduce bugs, what their effect is on the size of the compiled program, and how close the compiled program is from the original source (which, granted, is somewhat subjective).
It has the same effect on reflection, although reflecting and decompiling are completely different.
First, let's go over the difference between the two terms.
Reflection provides the ability to discover type information within an assembly at runtime. This is part of the framework, and makes possible features such as code completion in the IDE, references between assemblies, etc. It's also used in frameworks, such as ASP.NET (you can basically refer to classes, or web controls, in markup and instances will be dynamically created at runtime using reflection). This is also used in serialization, which is the core of web services, WCF, the web part framework, session state, AJAX, and more.
Decompiling is a term for converting machine code to a higher-level, human readable code. The .NET framework uses an intermediary language (IL) which is a machine-agnostic low level language somewhat similar to assembly, minus CPU specific things like registers. The runtime itself is what actually takes this IL and compiles it to the code that's actually specific to the local machine through a process called JIT'ing. Obviously, your code has to be in IL for the runtime to understand it (though there are processes to pre-compile or pre-JIT IL code).
There is no overlap between the two. Reflection only uses the metadata stored in the assembly's manifest, it does not look at the actual IL code the compiler generated. You'd never be able to use reflection to infer how a method was actually implemented
With that said, there are various tools to obfuscate IL code, making it harder to understand. One popular one tool Dotfuscator.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm new here and have a problem. I am having to pick up C#, but I have no experience in it. I'll mainly end up (probably) doing tooling type stuff, but I haven't programmed in awhile and I don't know a huge bunch about it.
I have to write a class that depicts an enemy spaceship, but I am not quite sure how! I seem to have forgotten everything I learned in Java and VB about writing classes. Where might I find good resources for re-learning to write classes, learning to write a class in C#, and learning to write classes for video games?
Specifically, I have to show how it interacts with other enemies, weapons, how big it is, how it looks, etc.
I'm not asking for code, just for resources on learning.
Maybe you should ask on the gamedev stackexchange platform in order to get more pertinent responses : Gamedev Stackexchange
Also, MSDN is a good solution : Learn Visual C# on MSDN. They describes the basics a lot, concepts, classes, structs, interfaces, with a lot of tutorials and resources (like Creating a Maze for example).
Not a direct answer but:
http://www.3dbuzz.com
They have incredible tutorials on c# and C and for the most part - programming logic is programming logic, once you have a way of thinking its a lot easier irrelevant of what the language is. They also have XNA stuff to help you with that.
You should stick to the MSDN Documentation. It's a good source of information for everything you need to know about C#.
Once you get a good hold on C# you should look into XNA Platform.
It's a free Game Development Engine by microsoft for C#.
You can make games for Windows, Xbox360 and Windows Phone.
http://www.microsoft.com/en-us/download/details.aspx?id=23714
This is the best tutorial I know to learn how to use XNA.
Well if you're starting from the ground up I would suggest download Microsoft's Visual Web Developer. It's a free IDE that will be very helpful for you when programming.
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express
Once you have that installed, you can follow csharp.net's introductory tutorials:
http://csharp.net-tutorials.com/basics/introduction/
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
So I'm thinking about making a GUI. My friend told me he knew how to do it in C#, so I went that method in setting the GUI up. Is there anyway to get a C# made GUI usable in java?
Yes you can. You absolutely should not.
I once wrote a perl application that used a VB GUI that i made, they communicated via OLE.
This is probably the worst construct you could ever do so don't :)
Not practically. You can't just give the C# compiler a Java file, or vice versa.
If you're really determined though, you can use IKVM to expose Windows Forms to Java.
There's also J# but it's not being actively developed anymore.
I think you should learn how to make a GUI in Java if you are coding in Java. However if you want both of C# and Java to interoperate, then you need a new layer which acts like a bridge between a C# program runs on CLR and Java program runs on JVM. The following link has a good explanation about how to call Java routines directly from a C# program over runtime bridges:
http://www.devx.com/interop/Article/19945/1954
You need to bind something on GUI with an appropriate logic. Such as File>New menu selection might exist for creating a new file. Therefore this menu command needs to be bound to a logic. You can not run away without writing these logic, the event handlers or without defining some other functionalities inside of GUI classes. Strictly speaking, you always need to write a lot of code on presentation layer which consists of GUI classes. So that, your friend does also need to build up the presentation layer itself. Because a useless user interface is called a prototype not a program. And also do not forget about that runtime bridges significantly decrease the performance. Eventually, I suggest you to go and learn how to make GUI in Java.
No! It would not work. Java's GUI classes are different, so even if you renamed your .cs files to .java files and made slight modifications, the code would not work.
No. It won't work. You can't compile Java and C# into a single executable package.
No. The way Java and .NET interact with the GUI is totally different.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have always had an interest in coding, and a while back a started to learn C#. Since I only do this as a hobby, i have been learning it very slowly and don't know too much yet, but when I started to read about C++ and how it runs closer to the OS, I started to wonder if I should start learning C++ instead. I know html and JavaScript pretty well and to me C# seemed to be somewhat similar to js, so it wasn't to hard. I just downloaded C++ Express and noticed it is in a very different style than what I'm used to. I'm wondering if I should stick with c# or try c++ (especially if I want to start playing with Arduino sometime in the future). What are some advantages/ disadvantages to both?
As a person who has done all of these languages professionally, I would say that C# is probably the easiest to learn while still being very powerful. There is a lot of help for the .NET platform both from the libraries standpoint and from the community as well. Unless you really want to get down and dirty with a language, stick with C#.
The bigger answer, however, is "it depends". If you are looking to learn a language for the sake of learning one, C# is the way to go. However, if you are thinking about possibly using this new skill in a job setting, look for what type of job you want and decide from there. If you are looking to build applications for yourself and your friends, stick with C#. You can build a Winforms app in about five minutes and you can scale to larger and more professional apps easily from there. C++ will be much more difficult to do the same with.
Coming from Javascript, I would probably recommend staying with C# if you don't want to get down and dirty with details. It will take care of memory management and several other low-level concerns that C++ makes you deal with manually, so it's a little less of a shock to go from an interpreted scripting language like Javascript or Python or Ruby to C#. It's kinda half-way between them and C++.
That said, if you want to learn more of how programming languages and computers in general work, go for C++. It's more complicated than C#, but learning C++ very well makes any language you learn after that easy. Plus with C++, there's virtually no limit to what you can do (C# imposes a few limits), and you pretty much have the entire computer with all its speed and resources at your disposal.
That said, C++ usually takes longer to do the same thing in. For instance, creating a Windows application with a GUI and everything would take a considerable amount of time in C++, but in C# it's trivial. It's a tradeoff you have to deal with, but like I said, if you learn C++ first, C# is cake. The converse is not necessarily true though.
If you want to work with Arduino, go for C++ (never worked with Arduino but the code snippets looked like C so..). C++ is very similar to C, and most C will compile as C++ with very little modification.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I was just wondering, is it at all possible to create sort of like a "Sub-language" in C# OR C++? or would a better term be "Extension"? And can somebody please provide links/resources?
Much appreciated! :)
thanks
jason
I think maybe the phrase you are looking for is Domain Specific Language?
One example is Boo for .net
Book on Boo: http://www.manning.com/rahien/
Link on building DSLs for .Net
The way I've always looked at C++ programming is that I am extending the language by creating new types to solve new problems.
It all depends on what you consider a "sub-language".
You could create just about anything you want if you're willing to put the time and effort into learning how to utilize the DLR (Dynamic Language Runtime).
Can you be more specific? You can build your own dynamic languages on the DLR. Also here.
For simplicities sake I'm making my contribution 'your-very-own-scriptlanguage'.
If you are not concerned about pre-compiled code but instead want something compiled in runtime, you could look into making your own script language and write a parser for it so you can execute it in runtime.
Well, .net is a multi-language platform. You would need to write a compiler of course, and you can write that compiler in any language, including C#. I've started a series about writing a brainf**k compiler in C#.
A compiler doesn't have to be Languague-to-IL, you can also write a compiler that compiles Language-To-C# and then uses the C# compiler (Some people call those compilers pre-processors). You just need to be sure that whatever you do can be translated to C# (or C++ if that's what you want to do). Then you can just define your keywords and language tokens.
Just keep in mind that creating new, insular programming languages can be a maintenance debt in the future and often is a sign of too much "Not invented here"-syndrome.
I've used Irony to implement a DSL and it worked out great. Keep in mind it's still very much a WIP and you'll probably find it pretty nice to work with.