新的脚本语言

发布于 2024-08-24 22:55:55 字数 486 浏览 6 评论 0原文

我正在尝试自己创建一种脚本语言(它不必是完美的 - 尽管如果它是完美的那就太好了),主要是因为我这样做是为了好玩并了解它们是如何创建的等。

根据这里的答案:创建脚本语言我应该研究什么是这样的: http://msdn.microsoft.com /en-us/library/xawadt95%28VS.85%29.aspx 。但是,我完全不知道 MSDN 页面的内容是什么。

有人可以帮忙吗?

聚苯乙烯 是否有任何针对 Windows 脚本宿主的免费/开源脚本语言,并且还具有可供我使用的完整源代码?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你在我安 2024-08-31 22:55:55

如果您这样做是为了好玩并了解语言是如何创建的,我建议您远离 Windows Script Host。相反,尝试从更好的示例中学习。好的第一步是访问 http://www.lua.org/,研究该语言,了解其实现方式,并自行开发。另一种从语言角度来看很糟糕但很容易实现的语言是Tcl。从 Ousterhout 的原始 Usenix 论文开始。

我希望我能推荐一本关于设计和实现您自己的编程语言的好书。我从来没有见过一个。 (我见过一些类似的坏书,但为了不尊重作者,我不会指出它们。)但是如果你能在一个好的大学图书馆度过一些美好的时光,你将能够找到一些有趣的东西文件。您可能还会发现值得查看我们的 Friedman 和 Wand 的书 编程语言要点 —虽然它非常技术性,但它确实有一些关于编写解释器的好东西。 PJ Brown 还写了一本很好(但很老)的书,名为编写交互式编译器和口译员

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.

夜访吸血鬼 2024-08-31 22:55:55

制作简单脚本中断器的最简单方法是通过换行符将源代码拆分为数组并循环遍历每个成员。这是一个例子
字符串源=@”
打印你好世界!
停止
”);
foreach(source.split('\n') 中的字符串 a)
{
if(a.StartsWith("print "))
{
Console.WriteLine(a.Substring(6));
}
if(a == "停止")
{
Console.ReadLine();
}

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();
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文