简体   繁体   English

脚本语言设计?

[英]Scripting Language Design?

If I were to go to a dev. 如果我要去开发。 company and say "Please build me 'this' scripting language", are there any specific documents, and what types of documents that I should create, so they know exactly what I am wanting? 公司并说“请为我构建'此'脚本语言'”,是否有任何特定文档,以及我应该创建哪种类型的文档,所以他们确切地知道我想要什么?

Any guidance is much appreciated. 任何指导是非常感谢。

Thank you 谢谢

As Dave Swersky says, there are lots and lots of very well developed scripting languages already out there. 正如Dave Swersky所说,已经有很多非常完善的脚本语言。 Lua, for example, is very simple yet surprisingly powerful and has tiny yet efficient implementations. 例如,Lua非常简单,但功能却出奇的强大,并具有微小而有效的实现方式。

But if you really, really want a scripting language custom built for you, then the nicest thing you could do for the implementor would be to provide him with a description of the language in Backus-Naur form . 但是,如果您确实真的想要为您定制一种脚本语言,那么对实现者来说,您可以做的最好的事情就是为他提供Backus-Naur形式的语言描述。 Ideally, that will allow them to create a scanner and parser for your language with very little effort. 理想情况下,这将使他们能够毫不费力地为您的语言创建扫描器和解析器。 In addition, you will need to define your language's data types and how the map to the hardware's data types, and you will need to specify which library or built-in functions you want to provide, and how those will have effects in the outside world. 此外,您将需要定义语言的数据类型以及如何映射到硬件的数据类型,并且需要指定要提供的库或内置函数,以及它们将如何在外部环境中产生影响。 。 The Lua Reference Manual is concise yet complete and defines that language and its library well. Lua参考手册》简洁而完整,并很好地定义了该语言及其库。 You'll want to come up with something comparable, or make do with a hand-waving simplification and hope your implementors invest their own brain power in filling the gaps left by your description. 您可能想提出一些可比的东西,或者通过挥舞性的简化来做,并希望您的实现者投入自己的脑力来填补您的描述所留下的空白。

It would help if you could offer some detail on why you would want to go to the time and expense to develop your own scripting language when there are at least three or four excellent options out there for free. 如果您可以提供一些详细信息, 说明为什么要花至少三四个免费的绝佳选择来开发自己的脚本语言, 为什么会花一些时间和金钱会有所帮助。 If you have a targeted need for a language that does something specific, read up on Domain Specific Languages. 如果您有针对性地需要某种特定功能的语言,请阅读特定于域的语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM