.net scripting languages [closed]

匆匆过客 提交于 2019-12-18 12:27:18

问题


what do people use for scripting in .net apps. New question after MS drops IronPython

IP used to be my favorite; then Lua

What do I mean by scripting. I mean I have a large system management tool that allows users to plugin bits of smartness, this include assemblies and scripts. What language should I use for the scripts. So I need an embeddable interpreter, prefably one that integrated well with .net

The MS announcement is here

http://www.theregister.co.uk/2010/10/22/microsoft_kills_dynamic_languages_projects/

F# - several people have said F#. Is F# usable as an embedded scripting language?

EDIT: My new best friend for this is javascript; there are several quality implementations for .net


回答1:


Powershell is .net net native scripting shell that can be imported into your app. As time has gone on I have come to use it to do everything from unit test to provide extensibility. Also it ships on every version of Windows after 7 so you don't need to worry about installing it, and efforts are underway to develop a mono based version.




回答2:


We are using C# most of the time for scripting. Compilation and integration on the fly is possible inside own applications. Even as a replacement for pure scripting is feasible in a nice way, have a look at http://www.csscript.net/

After a while, I came across IronPython. If I had to redo the scripting in my app I would opt for it as it proves to have a greater flexibility at runtime. There is no need for tedious AppDomain handling among other aspects.




回答3:


IronRuby




回答4:


F#, Lua.

But we often use C# either via Mono: How To Host Mono’s CSharp Compiler as a Service in .NET - For Runtime Code Evaluation/REPL or via implementing in our apps or via The C# Script Engine




回答5:


IDE Scripting (think VBA):

Visual Studios Tools for Applications (VSTA) which supports VB and C#. It's the current supported microsoft solution and is meant to replace VSA and VBA. They neglected it for a while but have taken it back up. VSTA is like VBA and exposes an IDE. The end used will need to install VSTA on their machine which is free.

http://www.microsoft.com/en-us/download/details.aspx?id=38806

Straight Text scripting:

PowerShell

http://blogs.msdn.com/b/kebab/archive/2014/04/28/executing-powershell-scripts-from-c.aspx

Roslyn (this is superseding CodeDom but is still in the preview state)

https://roslyn.codeplex.com/

http://msdn.microsoft.com/en-us/vstudio/roslyn.aspx

CodeDom (a little heavier than you might want)

http://msdn.microsoft.com/en-us/library/y2k85ax6.aspx

http://www.codeproject.com/Articles/12852/Compile-and-Run-VB-NET-Code-using-the-CodeDom

http://www.codeproject.com/Articles/3289/Dynamic-Code-Generation-and-Code-Compilation

DynamicMethod (I like this because I can define the code as a function with specific parameters and returns. It narrows scripting to exactly what you want)

http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx




回答6:


F#

Windows Scripting with VB Script




回答7:


We made a decision almost 2 years ago and the finalists were Python and Lua. At that time, IronPython got the nod because it was supported by MS. VBA quit getting licensed to new customers back in 2007, VSTA looks to be far cheaper, but at $50/seat (with an annual committment in the high-5 to low-6 digit range) it is still beyond what the boss will accept.

It looks like we need to re-evaluate our scripting language decision. The current application we're using this in, is one that licenses for mid 5-digits and automates several of our other software products (that sell for mid-3 to low-4 digits.

Probably the books that are most applicable for scripting inside applications are the books written for game devlopers, usually with titles like "AI for games." A lot of other companies that make money selling software have made the decision to chose lua or python for some decent reasons, and it might be helpful to read some details explaining why they went those routes.




回答8:


IronPython, Miguel de Icaza of mono fame has taken over as project leader. http://tirania.org/blog/archive/2010/Oct-22.html




回答9:


Answering in 2018:

You might want to look at MS ClearScript https://github.com/Microsoft/ClearScript.

It is JavaScript (V8-engine) that you can embed into a .NET app.




回答10:


  • Iron Js: https://github.com/fholm/IronJS/
  • Boo: http://boo.codehaus.org/
  • Lua.NET: http://www.lua.inf.puc-rio.br/post/9

If you need a custom DSL you can write your own using the DLR. http://en.wikipedia.org/wiki/Dynamic_Language_Runtime

The most poular parser generator I know is antlr which can generate .NET parsers http://www.antlr.org/

For simple validation and config scripts you can use Spring.NET's expression language: http://www.springframework.net/doc-latest/reference/html/expressions.html




回答11:


For those looking for .Net Standard/Core support, V8.Net now supports it. You can also use it within ASP.NET web apps if you ever wanted scripting on the back-end. I'm using it now in a VPL project (FlowScript) to add server-side scripting that also exposes select .Net types within the V8 engine.




回答12:


Part of the question is what do you want the language to be like. Maybe you want the full power and flexibility of C#. Or maybe you want it to be a little simpler so people can use it who may not be real programmers.

I just posted my Silk library on GitHub for .NET. It takes the second approach and has a language without excessive punctuation and isn't case sensitive. It also is very loose with data types.

It's very easy to use. Just register the functions your code makes available to the script, compile the source to bytecode, and run it. When one of your functions are called, an event is raised and your code can implement that function.




回答13:


https://sharpscript.net/ I just found this, no previous experience of it. This has similarities with Javascript, has support for templating syntax, it has various discovered and not yet discovered applications especially making websites/webapps.



来源:https://stackoverflow.com/questions/3997911/net-scripting-languages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!