Live data from Hacker News

PicoC: A very small C interpreter

github.com

41–50 of 51 posts

Re: PicoC: A very small C interpreter

#41

Shameless 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 don't need bug reports unless you are also willing to fix the bug yourself in a pull request or by emailing a diff.

That sounds very condescending and off-putting.

Re: PicoC: A very small C interpreter

#42

Shameless 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.

Did you consider contributing to libfirm[0]/cparser[1]

0: http://pp.ipd.kit.edu/firm/ 1: https://github.com/MatzeB/cparser

Re: PicoC: A very small C interpreter

#43
post #19
post #3

Obligatory 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.

You make a good point. To some extent this reflects that PicoC wasn't originally a library at all. It was a standalone interpreter that I later converted to library form. 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 somethi…

Use a typedef in your own source files.

Re: PicoC: A very small C interpreter

#44
post #26
post #22

Earlier quoted context omitted.

Rather enjoyed flicking through that. I wish there was more of an overview for those of us who haven't thought about this stuff for a few years.

I recommend: just read and reread, commenting it as you go, until it all makes sense. It's written in a very limited dialect of C --- most notably, it doesn't use structs --- because it compiles itself. The expression parser in particular would be clearer with structs rather than array offsets. But once you realize that's why it's so gnarly in places, it's straightforward to mentally translate. It's a very simple des…

https://github.com/rswier/c4/blob/master/c4.c#L132

Ehehe.

Re: PicoC: A very small C interpreter

#45

Some time back i used picoc to write c programming visualizer. Such a tool is possible only with picoc. http://dev.pointers.io/#filename=test4.c

This is kinda great; I've thought about having something like it for "running" (simulating) embedded code on a PC, where the compiler just ignores (or asks the user for a value) when hitting anything that isn't available on the host pc (registers, etc).

Re: PicoC: A very small C interpreter

#46
post #39

Earlier quoted context omitted.

Given it's written in C, it seems like a direct port to Javascript might be a much better option.

Any particular reason for that?

A lot of c will translate very simply to JavaScript and any parsing or string manipulation will be insanely easier.

Re: PicoC: A very small C interpreter

#47

Shameless 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.

Did you consider contributing to libfirm[0]/cparser[1] 0: http://pp.ipd.kit.edu/firm/ 1: https://github.com/MatzeB/cparser

I've looked at libfirm a fair bit. I do think it is interesting. Thanks for the link to the c frontend.

Re: PicoC: A very small C interpreter

#48

Shameless 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 don't need bug reports unless you are also willing to fix the bug yourself in a pull request or by emailing a diff. That sounds very condescending and off-putting.

I can rephrase - bug reports are fine, But I don't need issues which ask why it cant compile xyz yet (Usually the answer is because there aren't enough hours in the day).

edit: I have tweaked the readme, don't let it put you off

Re: PicoC: A very small C interpreter

#49

Shameless 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 don't need bug reports unless you are also willing to fix the bug yourself in a pull request or by emailing a diff. That sounds very condescending and off-putting.

Sounded quite straightforward to me. How else would you have preferred him to phrase it?

Re: PicoC: A very small C interpreter

#50
post #39

Earlier quoted context omitted.

Any particular reason for that?

A lot of c will translate very simply to JavaScript and any parsing or string manipulation will be insanely easier.

How can parsing and string manipulation be easier than just compiling C to Javascript using Emscripten? The interpreter already works in C. Wouldn't translating it manually to Javascript be extra effort?
Post reply on HN