Unix Programming - Small, fast embeddable interpreter

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2005 > Small, fast embeddable interpreter





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Small, fast embeddable interpreter
William Ahern

2005-01-07, 2:47 am

I'm looking for a small, fast, embeddable--in C--language interpreter. I
don't care which language, just small, fast and Free Software. The
operations involve simple manipulation on strings; nothing more, nothing
less, though the ability to create subroutines would be nice.

I haven't found anything really lightweight, suitable for a very large
number of very small, short executions.

What I'm currently writing is an embeddedable interpreter for a sub-set of
Bourne Shell syntax. I had written a shell variable parser (e.g.
${xxx}, ${xxx-${yy}}) but have come to need the ability for more complex
conditionals than simple variable existence tests.

I'll continue reinventing the wheel for my own sake, but would rather use
something more mature for my other projects.

TIA,

Bill
Paul Pluzhnikov

2005-01-07, 2:47 am

William Ahern <william@wilbur.25thandClement.com> writes:

> I'm looking for a small, fast, embeddable--in C--language interpreter. I
> don't care which language, just small, fast and Free Software.


TCL is about as small as they come.
http://www.tcl.tk/advocacy/whytcl.html

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Erik Max Francis

2005-01-07, 2:47 am

William Ahern wrote:

> I'm looking for a small, fast, embeddable--in C--language interpreter. I
> don't care which language, just small, fast and Free Software. The
> operations involve simple manipulation on strings; nothing more, nothing
> less, though the ability to create subroutines would be nice.
>
> I haven't found anything really lightweight, suitable for a very large
> number of very small, short executions.


Someone else mentioned Tcl. Io would also probably be a good choice.

--
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
I needed sunshine in my day / Something to wash away the pain
-- Zhane
Russell Shaw

2005-01-07, 2:47 am

William Ahern wrote:
> I'm looking for a small, fast, embeddable--in C--language interpreter. I
> don't care which language, just small, fast and Free Software. The
> operations involve simple manipulation on strings; nothing more, nothing
> less, though the ability to create subroutines would be nice.
>
> I haven't found anything really lightweight, suitable for a very large
> number of very small, short executions.
>
> What I'm currently writing is an embeddedable interpreter for a sub-set of
> Bourne Shell syntax. I had written a shell variable parser (e.g.
> ${xxx}, ${xxx-${yy}}) but have come to need the ability for more complex
> conditionals than simple variable existence tests.
>
> I'll continue reinventing the wheel for my own sake, but would rather use
> something more mature for my other projects.


TCL or Lua: http://www.lua.org/ or guile: http://www.gnu.org/software/guile/
Pascal Bourguignon

2005-01-07, 7:48 am

William Ahern <william@wilbur.25thandClement.com> writes:

> I'm looking for a small, fast, embeddable--in C--language interpreter. I
> don't care which language, just small, fast and Free Software. The
> operations involve simple manipulation on strings; nothing more, nothing
> less, though the ability to create subroutines would be nice.
>
> I haven't found anything really lightweight, suitable for a very large
> number of very small, short executions.
>
> What I'm currently writing is an embeddedable interpreter for a sub-set of
> Bourne Shell syntax. I had written a shell variable parser (e.g.
> ${xxx}, ${xxx-${yy}}) but have come to need the ability for more complex
> conditionals than simple variable existence tests.
>
> I'll continue reinventing the wheel for my own sake, but would rather use
> something more mature for my other projects.


On the mini-tiny side:
http://modeemi.cs.tut.fi/~chery/lisp500/
a "Common-Lisp" in 500 lines of C code...

Otherwise, just use ecls, the embeddable Common-Lisp
http://ecls.sourceforge.net/

(I believe clisp http://clisp.cons.org is embeddable too, and should
not be much bigger than ecls).

Otherwise, there's always the guile option if you prefer scheme...

--
__Pascal Bourguignon__ http://www.informatimago.com/

In a World without Walls and Fences,
who needs Windows and Gates?
zentara

2005-01-07, 5:59 pm

On Thu, 6 Jan 2005 19:22:37 -0800, William Ahern
<william@wilbur.25thandClement.com> wrote:

>I'm looking for a small, fast, embeddable--in C--language interpreter. I
>don't care which language, just small, fast and Free Software. The
>operations involve simple manipulation on strings; nothing more, nothing
>less, though the ability to create subroutines would be nice.
>
>I haven't found anything really lightweight, suitable for a very large
>number of very small, short executions.
>
>What I'm currently writing is an embeddedable interpreter for a sub-set of
>Bourne Shell syntax. I had written a shell variable parser (e.g.
>${xxx}, ${xxx-${yy}}) but have come to need the ability for more complex
>conditionals than simple variable existence tests.
>
>I'll continue reinventing the wheel for my own sake, but would rather use
>something more mature for my other projects.


Perl has "microperl" which I have used for small scripts.

It compiles to about 900k stripped, and after upx'ing it,
it is about 350k. It supports most of the math and trig operations.


From the PERL source tree, README.micro
########################################
#######
microperl is supposed to be a really minimal perl, even more
minimal than miniperl. No Configure is needed to build microperl,
on the other hand this means that interfaces between PERL and your
operating system are left very -- minimal.

All this is experimental. If you don't know what to do with microperl
you probably shouldn't. Do not report bugs in microperl; fix the bugs.

We assume ANSI C89 plus the following:
- <stdlib.h>
- rename()
- opendir(), readdir(), closedir() (via dirent.h)
- memchr (via string.h)
- (a safe) putenv() (via stdlib.h)
- strtoul() (via stdlib.h)
(grep for 'define' in uconfig.sh.)
Also, PERL times() is defined to always return zeroes.

If you are still reading this and you are itching to try out microperl:

make -f Makefile.micro

If you make changes to uconfig.sh, run

make -f Makefile.micro regen_uconfig

to regenerate uconfig.h.





--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Andreas Klimas

2005-01-16, 5:50 pm

William Ahern wrote:
> I'm looking for a small, fast, embeddable--in C--language interpreter. I


http://directory.google.com/Top/Com...mplementations/

Forth is very compact, simple and, compared to other
byte code interpreting languages, fast.

best wishes
Andreas Klimas

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com