Sub Language C# [closed] - c#

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.

Related

Running native Delphi code in dot net environment with c sharp [closed]

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 9 years ago.
I have a Delphi program consisting of mostly Visual Interface(Buttons, TextBoxes etc.) and a little bit business logic.
The business logic is mostly included in Pl-Sql of Oracle Database running by Delphi.
I want to carry the project in Delphi to C Sharp but i want to do this part by part.
What i think is to create a C Sharp project in Visual Studio and to run it with Delphi code(including Visual Interfaces) and part by part replace the code and the Visual Interface in Delphi with C Sharp.
Is it possible?
Mixing Delphi and C# GUI in the same application is possible, but hard to achieve. You'll need to set up a whole infrastructure to organise interop between the two languages. You'll end up creating a huge amount of interop code that you will subsequently abandon. Even worse, the interop code will need to be two way. You'll sometimes have C# visual code talking to Delphi non-visual. And vice-versa. The idea of converting the code module by module sounds good, but I predict it will entail vast amounts of interop scaffolding.
It would be easier to slice it along the visual/non-visual divide, but that's not what you are proposing. So frankly I think your current plan is far from optimal. I would not entertain it. I think a clean port is the best option.
Remobjects Hydra seems to be exactly what you are looking for.

How Do REPL Interpreters For Compiled Languages Work? [closed]

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 cant even begin to understand how they work, its a very broad question i guess. How is it possible that one could take a language such as C# which is compiled to IL for the CLR, then further JIT compiled into machine code at run time, and write an Interpreter or REPL for it as implemented in the mono project. How did they get that right?
What is the issue? Machine code is just some data (laying in virtual memory pages which are executable). You can produce that data, then, since it is also code, run it.
You can produce machine code in memory in various ways. For example, you could use LLVM or libjit or many other libraries (or even make your own).
Some implementations of some langauges (I was thinking of the SBCL implementation of Common Lisp) are even able to translate to machine code every line you are interactively typing. And this is not new, some 1957 computers did it (e.g. the French CAB500 for PAF).
You can even generate some source code (e.g. in C), fork a compilation process, then dynamically load that code, e.g. with dlopen(3). Current compilers and processors are fast enough to make that compatible with delays for user-friendly interaction. My MELT domain specific language (to extend GCC) does that successfully.
AS commented by millimoose, Mono is free software, so you can study its code.
The equivalence of code and data is a fundamental property of computers. Likewise the equivalence of numbers and demonstrations in a fundamental insight of Gödel and Turing (and when you hear your favorite MP3 music, you use that too).

Writing an enemy class in c#: Where does one begin? [closed]

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/

What are some advantages to the different programming languages? [closed]

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.

How to write another Debugger for .NET using CLR [closed]

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.

Categories