Language interpreters are great for experimenting with new or buggy pieces of code - just experiment at the prompt and copy what works into a file for posterity. I've started looking through the parsing code for PicoC, and its all nice and readable. But I'm surprised this was used in an actual system, embedded or not. C is an absolutely miserable language whose saving graces are executable size and speed. It lacks re…
PicoC: a very small C interpreter for scripting
31–40 of 47 posts
Re: PicoC: a very small C interpreter for scripting
#32Re: PicoC: a very small C interpreter for scripting
#33Would this be allowed in an iPhone application, since it's all C?
AFAIK no programs are allowed which interpret code.
http://arstechnica.com/apple/news/2010/06/devs-cautiously-op...
Re: PicoC: a very small C interpreter for scripting
#34Re: PicoC: a very small C interpreter for scripting
#35Re: PicoC: a very small C interpreter for scripting
#36Personally 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).
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?
Re: PicoC: a very small C interpreter for scripting
#37Earlier quoted context omitted.
Yeah. Why reuse something when you can write it yourself!
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…
Re: PicoC: a very small C interpreter for scripting
#38The links for these should read (code.google.com)
Re: PicoC: a very small C interpreter for scripting
#39How refreshing to see something that only has 'readline' as a dependency and otherwise just requires a working C compiler and 'make'.
Yeah. Why reuse something when you can write it yourself!
- each dependecy makes it harder to build your project
- and makes it more brittle (libraries goes obsolete, changes versions, occasionaly have non-backward-compatibile changes, on different systems different versions of libraries are available, etc)
- most of the time you use only small fraction of each library, it is also common (at least in static typing world) that libraries enforces data structures on you, so sometimes it's easier to reinvent wheel, than to integrate your app with some library
- when you need to add some feature to library you often have to go throught hoops (inherit some class, make some wrappers and use it instead of what you'd use normally) - it is much easier to keep things simple, when you have controll over interfaces and can just change what you want, also architecture is simpler without proxies, wrappers and delegates
- static binaries on linux don't work after a few years
- dynamic linked binaries works as long as somebody worries about dependency problems - and this means you
- you can keep all dependencies in VCS together with your project, but often it's not legal (LGPL)
- not really important for most apps - dependencies bloats your app
Dependencies in programming are like moving parts in enginering - there should be as few of them as possible.
Re: PicoC: a very small C interpreter for scripting
#40Language interpreters are great for experimenting with new or buggy pieces of code - just experiment at the prompt and copy what works into a file for posterity. I've started looking through the parsing code for PicoC, and its all nice and readable. But I'm surprised this was used in an actual system, embedded or not. C is an absolutely miserable language whose saving graces are executable size and speed. It lacks re…
As you suggested, it offers the possibility to switch from interpreted to compiled code at no extra effort.