嵌入编程语言到一个程序 [英] Embedding a Programming Language Into a Program

查看:148
本文介绍了嵌入编程语言到一个程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一定程度上脚本化添加到我正在写一个应用程序。粗略地说,我喜欢的方式嵌入编程语言的API到我的程序。我看着TinyPy,但我担心 - 鉴于它的小尺寸 - 这可能是欺骗性的限制(即它的外观和感觉如Python,但缺乏许多羽翼丰满的Python的功能)。

我不希望我自己写的编程语言;我想简单地采取一个比较知名的语言,用户可以编写函数,然后就可以调用这些函数/从我的应用程序,它会在C编写的传递函数的参数。

我也想成为访问任何数据类型的函数返回到我,也从C。

有没有人有任何建议,一个API /库来使用,这将是既轻巧,比较功能齐全,并配有比较好用或易于理解的C库?

谢谢!


解决方案

您可能想看看 SpiderMonkey的,这将使你在你的C程序中嵌入一个Javascript引擎。

I'd like to add some degree of "scriptability" to a application I'm writing. Roughly speaking, I'd like a way to embed a programming language API into my program. I've looked at TinyPy, but I'm worried that - given it's small size - it might be deceptively limiting (i.e. it looks and feels like Python, but is lacking many of the features of full-fledged Python).

I'm not looking to write my own programming language; I'd like to simply take a relatively well-known language that users can write functions in, and then be able to call those functions/pass those functions parameters from my application, which will be written in C.

I'd also like to be access any data types those functions return back to me, also from within C.

Does anyone have any suggestions as to an API/Library to use, which would be both lightweight, relatively full-featured, and with a relatively easy to use or easy to understand C library?

Thanks!

解决方案

You might want to look at SpiderMonkey, which will allow you to embed a Javascript engine in your C program.

这篇关于嵌入编程语言到一个程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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