?
Solved

small C interpreter

Posted on 2003-03-01
11
Medium Priority
?
799 Views
Last Modified: 2008-01-09

  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
0
Comment
Question by:stewe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 11

Expert Comment

by:cup
ID: 8051347
Try PocketC.  It is almost the same as C except you can use strings in case statements.  http://www.orbworks.com/

They have versions that work on Palm and Windows CE.  I don't know about Symbian.
0
 
LVL 11

Expert Comment

by:cup
ID: 8052395
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
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8053055
Check this out,
http://eic.sourceforge.net/overview/

Exceter
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:stewe
ID: 8053705
Thanks, I start to check them.
0
 
LVL 1

Author Comment

by:stewe
ID: 8081610
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
0
 
LVL 11

Expert Comment

by:cup
ID: 8082503
Have you looked at the other C Compilers on the site?  There is QWIKC and PCC12C.  

Another language: how about Forth?
0
 
LVL 1

Author Comment

by:stewe
ID: 8084429
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
0
 
LVL 11

Expert Comment

by:cup
ID: 8084514
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.
0
 
LVL 1

Author Comment

by:stewe
ID: 8084555

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
0
 
LVL 1

Author Comment

by:stewe
ID: 8106613

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
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8271017
Administrative action - PAQ'd and points NOT refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question