A New Language In C#
-
-
Hi All, I was wondering if it would at all be possible to create my own very small and simple programming language using C# Express Edition? And how one might go about doing so? I'd appreciate any help I can get on this. Thanks in advance :-) j.t.
j.t.
Basically you will need to learn assembly language i.e. how an executable is created Then you would need to parse you language and produce your assembly code based on the parsed values Quite a simple theory really :P
If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
-
Hi All, I was wondering if it would at all be possible to create my own very small and simple programming language using C# Express Edition? And how one might go about doing so? I'd appreciate any help I can get on this. Thanks in advance :-) j.t.
j.t.
-
Hi All, I was wondering if it would at all be possible to create my own very small and simple programming language using C# Express Edition? And how one might go about doing so? I'd appreciate any help I can get on this. Thanks in advance :-) j.t.
j.t.
What you will need to do is create a program that will take in source code and emit object code. The source code will be written in your language; the object code be targeted at some machine. So it will either be machine code, aimed at a particular CPU, or byte code that runs on some virtual machine (e.g. the CLR in .Net or Java in a JVM). Effectively this means you have to write a compiler (or interpreter) in C#. This is not a trivial task. You might try looking at this book: Compilers: Principles, Techniques, and Tools Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman Addison-Wesley Pub Co ISBN: 0201100886 Regards David R
-
What you will need to do is create a program that will take in source code and emit object code. The source code will be written in your language; the object code be targeted at some machine. So it will either be machine code, aimed at a particular CPU, or byte code that runs on some virtual machine (e.g. the CLR in .Net or Java in a JVM). Effectively this means you have to write a compiler (or interpreter) in C#. This is not a trivial task. You might try looking at this book: Compilers: Principles, Techniques, and Tools Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman Addison-Wesley Pub Co ISBN: 0201100886 Regards David R
Or it could be an interpreted language and maybe not general-purpose.
-
Hi All, I was wondering if it would at all be possible to create my own very small and simple programming language using C# Express Edition? And how one might go about doing so? I'd appreciate any help I can get on this. Thanks in advance :-) j.t.
j.t.
-
Hi All, I was wondering if it would at all be possible to create my own very small and simple programming language using C# Express Edition? And how one might go about doing so? I'd appreciate any help I can get on this. Thanks in advance :-) j.t.
j.t.
I took a few minutes and made a programming language. Create a console application (named GuffaProgrammingLanguage of course), and put this in the Main method:
static void Main(string[] args) {
foreach (string line in File.ReadAllLines(args[0]+".gpl")) {
switch (line.Substring(0,Math.Min(line.Length,4))) {
case "out ": Console.WriteLine(line.Substring(4)); break;
case "time": Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); break;
case "end.": return;
default: Console.WriteLine("Syntax error."); return;
}
}
}Create a text file in the bin folder named test.gpl with this content:
out Hello
out World!
time
end.Open a console window and go to the bin folder, start the program with
GuffaProgrammingLanguage test
and you get an amazing result like this:Hello
World!
2009-02-11 18:48:49:)
Despite everything, the person most likely to be fooling you next is yourself.
-