Unfortunately, function pointers aren't supported, and it's 10x slower than equivalent compiled C, if not more, and perhaps slower than Lua (and we aren't even talking about LuaJIT). There also appear to be some issues yet to be dealt with, as can be seen on the previous project page at Google Code: https://code.google.com/p/picoc/issues/list
PicoC: A very small C interpreter
11–20 of 51 posts
Re: PicoC: A very small C interpreter
#12Do people who use this call it "peacock" or "pico see"?
Re: PicoC: A very small C interpreter
#13It's (of course) less complete than PicoC, but it might be the single most useful introduction to compiler construction I've read.
Re: PicoC: A very small C interpreter
#14Shameless self promotion of my work in progress C compiler https://github.com/andrewchambers/cc which is attempting to create a modern cross platform C compiler. One of my goals is to make the entire toolchain rapid to port and hack on. I am pretty sick of gcc and llvm taking 20 mins just to build from source. I would love to find serious collaborators.
Re: PicoC: A very small C interpreter
#15Earlier quoted context omitted.
While I'm on the subject the same also goes for header include guards - when you get a conflict, it's actually quite annoying to track down. (Not least because it's such a rare occurrence that you probably won't expect it and will likely end up on a wild goose chase at some inconvenient moment.) I stopped using the file name at all in my include guards a few years ago, and use a GUID instead. For example: #ifndef HEA…
> Also consider the use of #pragma once - though as far as I can tell, this (still) isn't ISO, so I've decided to avoid it. Depends on your target platform. GCC, clang/LLVM, Visual C++, and many proprietary compilers all support it. What platform are you targeting that doesn't support it? Because if you're writing any non-trivial useful code, it's highly likely that your code is not pure ISO C; you're using some libr…
Re: PicoC: A very small C interpreter
#16PicoC runs ok in 64KB although it is a bit cramped. I like that you can write scripts in C on the actual device without needing a host computer of any kind. It's also been fairly popular for embedding as a scripting language in desktop applications, mostly because it's small and easy to integrate. It's really designed for scripting so don't expect it to be fast though.
Re: PicoC: A very small C interpreter
#17Shameless self promotion of my work in progress C compiler https://github.com/andrewchambers/cc which is attempting to create a modern cross platform C compiler. One of my goals is to make the entire toolchain rapid to port and hack on. I am pretty sick of gcc and llvm taking 20 mins just to build from source. I would love to find serious collaborators.
I am all in favor of hacking for studying and fun. But for practical reasons - are you familiar with Bellard's tcc?
I love C so considered using 8cc as a base for expansion, but there is a reason llvm and gcc are in C++ and not C. I dislike C++ for many logical and illogical reasons, and think Go is a fair compromise with keeping close to C roots.
Re: PicoC: A very small C interpreter
#18Re: PicoC: A very small C interpreter
#19Obligatory nitpick: C libraries should be careful to prefix all exposed identifiers, to minimize the risk of collision. But when you include picoc.h, which is careful to do this, you also get interpreter.h, which... is not.
The other factor is that the code as it stands is designed to be as readable as possible. I'm conscious that prefixing every identifier with "PicoC" will make the whole thing a bit less easy to read. I'm not sure if maximising readability is something that people really care about though. I'd be interested in hearing people's opinions on whether they'd prefer "struct ValueType" or "struct PicoCValueType" in a thousand places throughout the code.
Re: PicoC: A very small C interpreter
#20Can it interpret itself?