stewe
asked on
small C interpreter
Hi !
I try to find a small C interpreter, and I want to use it on different platforms. It shouldn't be complex, just for scripting. Target platforms: Palm,Symbian,PC.
Needed functionality:
- basic C keywords
- variables (and linking to outside)
- arithemtic&logical operations
- function calls (not define, just call - link to outside)
a sample C source:
if(iVar1==2 && (iVar2==3 || bVar1))
func1();
else
func2();
notes:
- it's good if the interpreter gets the variables through my gateway
- the same for functions, with va_arg
Thanks
Stewe
There are lots of compilers about but not many interpreters. You could also try the SmallC interpreter from http://www.mirror.ac.uk/collections/hensa-micros/collections/aeres/edsw/d-comlng.htm
ASKER
Thanks, I start to check them.
ASKER
PocketC: not available for Symbian and no source code
SmallC: the version what I found is full of 8086 assembly... but pretty small.
Eic: a very good one, but too large. I have to port it to Palm & Symbian!
Hmm maybe another language would be good... the primary goal: small, simple, easy to port.
Thanks
SmallC: the version what I found is full of 8086 assembly... but pretty small.
Eic: a very good one, but too large. I have to port it to Palm & Symbian!
Hmm maybe another language would be good... the primary goal: small, simple, easy to port.
Thanks
Have you looked at the other C Compilers on the site? There is QWIKC and PCC12C.
Another language: how about Forth?
Another language: how about Forth?
ASKER
I need an interpreter, not a compiler! Most of these 'script' C codes will be developed at design time, but can be changed run-time (maybe on the PDA). I don't want to compile and link on the PDA.
Forth is completely a black hole for me ;)
Maybe the basic can be good, if I can't find a good C interpreter. Basic seems to be easier and less complex so it may have more interpreters.
Stewe
Forth is completely a black hole for me ;)
Maybe the basic can be good, if I can't find a good C interpreter. Basic seems to be easier and less complex so it may have more interpreters.
Stewe
What part of the interpreter do you need? It will normally be
parser
code generation into some intermediate language
execution
That is basically what perl does. There are quite a few basic interpreters with source but it really depends on what you want to do with it. Normal OS script languages normally have forms of file and string manipulation and no types. Basic might be ok for that: it certainly is on DOS. Found quite a few interpreters on Google but I don't know whether the sources are in C or some weird assembler.
Good luck in your search.
parser
code generation into some intermediate language
execution
That is basically what perl does. There are quite a few basic interpreters with source but it really depends on what you want to do with it. Normal OS script languages normally have forms of file and string manipulation and no types. Basic might be ok for that: it certainly is on DOS. Found quite a few interpreters on Google but I don't know whether the sources are in C or some weird assembler.
Good luck in your search.
ASKER
internal structure doesn't matter for me, and it's normally as you mentioned. parser, p-code, run.
my communication software contains many events, which must be customizable. A user might want to override a default event handler on his PDA, and this is the point where a scripting language can be useful. I don't need fast execution...
Look at my example in the first message: an event handler. The script queries some variables, and based on them, calls the right (outer) function. I don't need script functions, arrays, structs,... just logical operation, variable handling, outer function call.
I found some interpreters, just I don't have the time for searching them. As I see, most of them are too complex, with huge source code (200-500K cpp source or more). It would mean that a scripting engine part is larger than current application.
Stewe
ASKER
Sorry, guys, I couldn't find a good one. I haven't got more time, so I have to write it. I hope it just means a few days work. I really need a simple one (but stable ;)
Most of them were too complex, or hard to port. Ah yes, and huge source code.
Since I can't delete this question, one of you may receive the points, based on admins. You tried to help, but I can't share these points.
Stewe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
They have versions that work on Palm and Windows CE. I don't know about Symbian.