在 C# 中实现脚本语言 [英] Implementing a scripting language in C#

查看:39
本文介绍了在 C# 中实现脚本语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个项目,我们应该让 3rd 方开发人员创建他们自己的 GUI/CodeBehind 驱动程序.我们的 GUI 在 WPF 上运行.

We got a project where we're supposed to let 3rd party developers create their own GUI / CodeBehind drivers. Our GUI is running on WPF.

现在,我们有很多这样做的可能性,但我们正在考虑的一件事是创建某种子 Xaml XSD 以让使用标记创建他们的 GUI(不知道它是否是 XAML或者我们自己的 XML-语言",然后让他们通过脚本语言进行代码隐藏.

Now, we got a number of possibilities for doing so, but one of the things we're considering is to create some sort of sub-Xaml XSD to let the create their GUI using markup (dunno if it'll be XAML or our own XML-"language", and then let them do their code-behind through a scripting language.

我想了想,这个模型似乎与魔兽世界让人们创建自己的GUI的方式有很多相似之处.WoW 的做法是实现 LUA 脚本语言,然后公开一些他们自己的 API 调用.我们想要类似的行为.

I thought about it, and this model seems to have many similarities to the way World of Warcraft let's people create their own GUI. The way WoW does it, is by implementing the LUA scripting language and then expose some of their own API calls. We want similar behaviour.

但是,我们正处于严格的截止日期前,而此实施并不是我们的首要任务.因此,我正在寻找一个 .Net 兼容的脚本解析器/编译器",以在我们的项目中使用.我们使用的脚本语言不是主要问题,我们只是希望能够相当快地实现它,而不需要太多的模糊.

However, we're on a sort-of strict deadline, and this implementation ain't the highest of our priorities. Therefore I'm looking for a .Net compliant script parser / "compiler", to use in our project. Which scripting language we're using is not a major concern, we just want to be able to implement it rather fast, without too much fuzz.

有人知道这种图书馆吗?或者你们有满足这些要求的更聪明的解决方案吗?

Does anyone know of this sort of library? Or do you guys have a smarter solution for these requirements?

显然,我们梦想着创建我们自己的 WYSIWYG 编辑器和我们自己的领域特定语言,但这对我们来说似乎太过分了.我们只想要一种脚本语言,它只能通过我们的 API 进行调用,同时让第 3 方开发人员使用条件、循环、OO 等.

Obviously, we're dreaming of creating our own WYSIWYG editor and our own domain specific language, but this seems like overkill for us. We just want a scripting language which can do nothing but to do calls though our API while letting the 3rd party developer use conditionals, loops, maybe OO, etc..

提前致谢:)

推荐答案

您可以使用 IronPython 作为您的脚本语言.这是一个 提供基本概念的文章 如何做到这一点.

You can use IronPython as your scripting language. Here's an article that gives a basic idea how you can do it.

这篇关于在 C# 中实现脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆