开发者

.net scripting languages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 3 years ago.

Improve this question

what do people use for scripting in .net apps. New question after MS drops I开发者_运维技巧ronPython

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


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.


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.


IronRuby


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


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


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.


F#

Windows Scripting with VB Script


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.


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


  • 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


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.

.net scripting languages [closed]


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜