开发者

Lisp as a Scripting Language in a C++ app [closed]

开发者 https://www.devze.com 2022-12-10 23:13 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 year开发者_如何学Gos ago.

Hey, I've been looking at the possibility of adding a scripting language into my framework and I heard about Lisp and thought I would give it a go. Is there a VM for Lisp like Lua and Python or am I in the wrong mindset. I found CLISP here, http://clisp.cons.org/, but am not sure if this is what I am looking for.

Can anyone point me in the right direction?


CLISP is just one implementation of Common Lisp. It's a very good implementation, and it does have some support for being embedded in other (C-based) programs, but that's not its focus and it's GPLed, which may or may not be a deal-breaker for you.

You might be interested in checking out ECL. This implementation is specifically designed to be embedded (indeed, the "E" stands for "Embeddable"!), and has numerous features that might be useful to you, including the ability to compile Common Lisp programs to C (as well as providing byte-code compilation and an interpreter).


Unless you need the whole of Lisp, you may want to settle rather on a Scheme implementation like Guile which is meant to be incorporated into another program.


Try Embeddable Common Lisp (ECL).

http://ecls.sourceforge.net/

It's targeted at embedding and you get only the parts of Common Lisp linked that your scripting language needs.


A Lisp is a good choice for an embedded language. Many people believe Lisp is hard but the syntax is relatively light, especially for non-programmers. There is essentially the prefix notation and that's it. Precedence rules are always unambiguous. Function names and variable names can be the same. You're pretty much free to use any characters you like for fun and var names.

With Lisp you can bend the syntax to your liking; the users do not have to learn common lisp. It is easy to extend and to provide, simpler facilities, such as expressing business rules or extracting data from files.

I guess my point is that the power and complexity of say Common Lisp, enables the provision of simple, domain specific constructs to the end user. Many other embedded languages will mean those users learning the intricacies of that language.


Chicken Scheme is another option for embedding. See here for details of the embeddable api.


There are a couple of easy options.

GUILE is the GNU extension language. It is an embeddable Scheme (dialect of LISP). GPL (naturally).

TinyScheme is a very small, very simple interpreter-based implementation of Scheme. It was successfully used by a malware company to do all kinds of nasty things. It is available in source form, I don't recall under what license(s).


Googling a little bit: Common Lisp as an Extension language

But keep in mind that Common Lisp wasn't designed from the ground up to be an extension language, unlike Lua or Guile.

A general advice: try to use an extension language that really makes the work of writing them easier, and remember that mastering Lisp so you can be really productive with it can take quite long (and there are not many people around that can stand so many parens xD).


Since it is not a Lisp, Fuzuli has a syntax similar to Lisp. It is easy to integrate it to C++ applications. The official site is http://www.fuzuliproject.org

Another one is newLISP at http://www.newlisp.org/ and it is also not a Lisp but very close to Lisp.


Lisp is a family of languages.

Common Lisp is an ANSI standard that is huge. Think C++ huge. Don't use it as a script language.

Unless you are targeting fairly hardcore programmers, Lisp as a scripting language is going to be...er....not well taking. Probably. Lua is likely a better bet as a script language.

That said, a Lisp is fine(technically) for implementing a scripting language.

0

精彩评论

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