• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

chkn/AluminumLua: NOTE: THIS WAS A TOY PROJECT AND IS NOT MAINTAINED

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

chkn/AluminumLua

开源软件地址(OpenSource Url):

https://github.com/chkn/AluminumLua

开源编程语言(OpenSource Language):

C# 97.0%

开源软件介绍(OpenSource Introduction):

AluminumLua

What?

A fast, lightweight Lua scripting engine written entirely in C#. It's called 'AluminumLua' (or 'alua' for short) as a poke at all those "iron" languages...

Architecture

AluminumLua does not use the DLR. Instead of generating an AST, the parser calls directly into an interface (IExecutor), that represents abstracted stack-based execution actions, such as Assignment or function Call.

This design enables different pluggable execution backends. Currently there is an InterpreterExecutor that directly executes the actions while the script is being parsed, and a CompilerExecutor that compiles a DynamicMethod.

The default execution policy uses the interpreter for the main script body and generates DynamicMethods for any defined function bodies.

Dependencies

.NET 4.0+ is required on Windows, or Mono 2.10+ anywhere else. There are no other dependencies.

Embed it

var context = new LuaContext ();
context.AddBasicLibrary ();
context.AddIoLibrary ();

context.SetGlobal ("some_func_in_lua", calls_this_func_in_csharp);
context.SetGlobal ("random_string", "hello");
// ...

var parser = new LuaParser (context, file_name); // < or leave file_name out to read stdin
parser.Parse ();

Building

Use Premake to generate a makefile or Visual Studio solution. Get it here: http://industriousone.com/premake/download

GNU Make

premake4 gmake
make

Visual Studio / Xamarin Studio / MonoDevelop / SharpDevelop

premake4 vs2010
(build the solution using your favorite tool)

The build produces the following products:

  • AluminumLua.dll is the script engine that can be referenced in other projects.
  • alua.exe is the command line interpreter. Pass a script file name or no arguments for a REPL.

Both products are self-contained and do not depend on the other.

After the Build

Run tests

premake4 test

Clean

premake4 clean

License

MIT/X11




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap