I am trying to create a scripting language by myself (it doesn't have to be perfect - although that would be great if it was), mostly because i'm doing it for fun and to learn about how they're created etc.
According to the answer over here: Creating a scripting language what I'm supposed to be looking into is this: http://msdn.microsoft.com/en-us/library/xawadt95%28VS.85%29.aspx . But, I have absolutely no idea what that MSDN page is on about.
Can somebody please help?
P.S. Are there any free/open source scripting languages that target the Windows Script Host, that also have full source code available for it that I can play around with?
Thank you
I started writing a guide to how to implement your own language engine for Windows Script Host but I ran out of steam and never finished it.
http://blogs.msdn.com/ericlippert/archive/tags/SimpleScript/default.aspx
If you're doing this for fun and to learn how languages are created, I advise you to stay far, far away from Windows Script Host. Instead, try learning from better examples. A good first step would be to get yourself on over to http://www.lua.org/, study the language, read about how it is implemented, and roll your own. Another language that is horrible from a language point of view, but very easy to implement is Tcl. Start with Ousterhout's original Usenix paper.
I wish I could recommend a good book on designing and implementing your own programming language. I've never seen one. (I've seen some bad books along these lines, but not wishing to disrespect the authors, I won't identify them.) But if you can spend some quality time in a good university library, you will be able to find some interesting papers. You might also find it worthwhile to check our Friedman and Wand's book Essentials of Programming Languages—although it is very technical, it does have some good stuff about writing interpreters. There's also a good (but very old) book by P. J. Brown called Writing Interactive Compilers and Interpreters.
The easist way to make a simple script interrupter is by spliting your source code by the line break character into an array and cycling through each member. Here is an example string source = @" print Hello World! stop "); foreach(string a in source.split('\n')) { if(a.StartsWith("print ")) { Console.WriteLine(a.Substring(6)); } if(a == "stop") { Console.ReadLine(); }
来源:https://stackoverflow.com/questions/2455032/new-scripting-language