开发者

What is a good scripting language for a small embedded system? [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 9 years ago.

Improve this question

I am looking for a scripting language that can be included in an embed开发者_JAVA百科ded system to allow the user to pre-configure the unit behaviour based on the system events (I/O port changes, time events...). The sort of control required is

if (some_event)
{ 
    do some stuff
    delay N seconds
    do more stuff
    if (some condition)
    {
        do something
    }
    else
    {
        delay until condition
        do something else
    }
}

Each of the "do stuff" parts of the would typically be to change the state of the IO or to allow/disallow the processing of one or more events.

There is no requirement for text processing or file handling unless it is required internally by the scripting language implementation.

The processor that I am using has some 8K of RAM and 20K of program store available after the normal operating code has been built. The firmware is written in C, so any source for the scripting language must also be in C.


We use Squirrel for this job. It is similar to Lua, but reference counted instead of garbage collected, so it tends to work better in very tight memory. On the downside, its community is much smaller.

I have also seen Lisp embedded successfully, particularly a Scheme-like derivative.

See also this other StackOverflow question: What are the available interactive languages that run in tiny memory?


Lua is my first choice as an embedded language. It's written in C, easy to expose your own functions to Lua, and by the looks of it some work has been done to get it working on embedded systems.


For embedded systems, try eLua.


A traditional choice is Forth. Small embedded systems such as microcontrollers are Forth's platform of choice. There are Forth many implementations with a variety of features, target platforms and licensing. The Forth Interest Group has a list of commercial implementation and non-commercial implementations.


I would give Lua a shot as it is a very small scripting language. It can be fully embedded

Lua is a fast language engine with small footprint that you can embed easily into your application. Lua has a simple and well documented API that allows strong integration with code written in other languages. It is easy to extend Lua with libraries written in other languages. It is also easy to extend programs written in other languages with Lua. Lua has been used to extend programs written not only in C and C++, but also in Java, C#, Smalltalk, Fortran, Ada, Erlang, and even in other scripting languages, such as Perl and Ruby.

Lua homepage


I had good experience using pawn (http://www.compuphase.com/pawn/pawn.htm) in a former project. A derivate of it is also used in the "E17" desktop environment, they call it "embryo". (https://trac.enlightenment.org/e/wiki/Embryo).


There are four fairly common languages for embedding (in no particular order):

  • Tcl
  • Lua
  • Forth
  • Scheme

Of these, Lisp and Forth are arguably the least end-user friendly. Lua currently seems to be the most popular (it's very popular in the gaming world), Tcl is arguably the simplest to learn (only 12 rules for the whole language) and is the defacto language in the EDA world.


Hope these helps you embedding perl script in c applications

http://www.ibm.com/developerworks/linux/tutorials/l-perlscript/index.html

Just google it for more informataion.I believe perl helps you alot in pattern (strings) searching. To learn perl go through this tutorial

http://mj12net.org/courses/perl/Teach%20Yourself%20Perl%20in%2021%20Days.pdf

Its a good tutorial,You can explore more than u think. Thank you


You could also try JavaScript, the V8 engine from Google is very easy to embed. Also the language itself is really small, so you can pretty much shape it into something that's suitable for your domain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜