TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PicoC: a very small C interpreter for scripting

76 pointsby rw-almost 15 years ago

9 comments

jakevoytkoalmost 15 years ago
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 reasonable features to use for scripting, like code-as-data in Bash or the dynamism of Python and Ruby. There are even embedded scripting languages like LUA. What does C offer as a scripting language, except perhaps familiarity?
评论 #1659321 未加载
mahmudalmost 15 years ago
I used Ch[1] in a commercial product and I would highly dis-recommend C as a scripting language. Something has to be said for high-level semantics, dynamism and syntax designed for interactive work. I find Lisp, Lua and Groovy to be joy to work with, but C is not an ideal extension/embedded/scripting language. Use something easier.<p><a href="http://en.wikipedia.org/wiki/Ch_interpreter" rel="nofollow">http://en.wikipedia.org/wiki/Ch_interpreter</a>
igraviousalmost 15 years ago
The links for these should read (code.google.com)
评论 #1659608 未加载
imurrayalmost 15 years ago
See also: <a href="http://bellard.org/tcc/" rel="nofollow">http://bellard.org/tcc/</a> a compiler, but small and #!tcc can be put at the top of .c files to make them scripts.<p>Also see: <a href="http://root.cern.ch/drupal/content/cint" rel="nofollow">http://root.cern.ch/drupal/content/cint</a> — an interpretor, but large.
评论 #1659148 未加载
评论 #1659974 未加载
评论 #1659317 未加载
jacquesmalmost 15 years ago
How refreshing to see something that only has 'readline' as a dependency and otherwise just requires a working C compiler and 'make'.
评论 #1659134 未加载
davidwalmost 15 years ago
I wonder how it compares to other small systems like Lua, or, say Antirez' Jim interpreter, in terms of speed and features.
评论 #1659088 未加载
antirezalmost 15 years ago
Very cool, there is even an interactive prompt. I wonder how hard is to make this interpreter "safe".
评论 #1658996 未加载
sgtalmost 15 years ago
Personally 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).
评论 #1659544 未加载
nitrogenalmost 15 years ago
Would this be allowed in an iPhone application, since it's all C?
评论 #1659071 未加载