Would this be allowed in an iPhone application, since it's all C?
AFAIK no programs are allowed which interpret code.
PicoC: a very small C interpreter for scripting
41–47 of 47 posts
Re: PicoC: a very small C interpreter for scripting
#42Personally I would use Forth for this. PicoC looks interesting but if I were to weigh my options (i.e. PicoC vs Forth in his example app UAV-onboard system, I would definitely go Forth).
Care to explain your reasoning behind this? As I understand, the main appeal of using C as a scripting language is the fact that you use the same language in compiled and interpreted part of your application. Drawbacks of using C interpreter for scripting could include large footprint and external dependencies, but as far as I can understand, they are not the case here. So what is your reasoning for Forth?
While not exactly a scripting language per se, Forth does have amazing interactive capabilities. It's extremely light-weight and it's easy to implement a new Forth on a new hardware architecture. Footprint issues aside, development time in Forth is usually shorter, and the ability to connect directly to a device's Forth "shell" and try out Forth words (functions), create new words, play around with hardware in real-time is invaluable.
Forth code is less readable if you don't know Forth, and occasionally Forth programmers write ugly code, but that is definitely the case for embedded C programmers too.
Re: PicoC: a very small C interpreter for scripting
#43Earlier quoted context omitted.
I was wondering if you really meant that, given that this is intended to be useful in embedded applications. To try to get a feel for the sort of programming you do and the sort of opinions you hold, I checked your profile - Bang - there's the answer right there: > I'm not trolling: > I actually think that. Is it really the case that you don't see the point in writing a minimal, small, clean, self-contained system th…
Just curious: Is it trolling, if I write out a strong opinion, that I don't necessarily believe, but that sounds reasonable to me, on a topic I'm trying to figure out what to believe, and then, when my sentiments get refuted, I say to myself, "Okay, now there's a reasonable way to think."
Re: PicoC: a very small C interpreter for scripting
#44See also: http://bellard.org/tcc/ a compiler, but small and #!tcc can be put at the top of .c files to make them scripts. Also see: http://root.cern.ch/drupal/content/cint — an interpretor, but large.
Re: PicoC: a very small C interpreter for scripting
#45See also: http://bellard.org/tcc/ a compiler, but small and #!tcc can be put at the top of .c files to make them scripts. Also see: http://root.cern.ch/drupal/content/cint — an interpretor, but large.
An interesting thing about tcc is how fast it is compared to gcc. If you can use it, that might be a great advantage in development times.
Re: PicoC: a very small C interpreter for scripting
#46Earlier quoted context omitted.
TCC has two even more cool things: 1) a library that lets you compile C code within a process, relocate it and execute it. This is rather faster than shelling out to run gcc to create a shared object and open it using dlopen. 2) an awesome 2004 demonstration where TCC was used as a boot loader. Take the Linux kernel source (slightly modified to remove some of the gccisms), add TCCBOOT and reboot the machine: as part…
I really love Fabrice, but "TCC" will, forever, remain Turbo C, not Tiny C. DOS weenie pride!
Re: PicoC: a very small C interpreter for scripting
#47Earlier quoted context omitted.
Hey David, what I think it's cool about picoC is that you can use it in places where you need to script at "hardware" level, like in robotics, embedded systems, and alike. Otherwise it is probably better to use Lua for instance, since I bet it is much faster (I just read part of the PicoC implementation and it is a pretty straightforward interpreter, very cool to read but hardly the faster) and safer.
Presumably, it wouldn't be that hard to create some Lua functions to interface with memory addresses, I would think.