So this tiny, free, GPLv3 program I wrote is a Lua-style or Python-style syntax pre-processor for C. Essentially, if you indent your code it removes the need for much of the punctuation. Pretend you are writing Lua while actually writing C, Java, or PHP. The new version also works on code that already has brackets and semicolons. It is just a simple flex parser that removes extra punctuation and adds it back. Frankly, I'd be surprised if someone hasn't come up with it before, but I can't find anything like it that's free and open-source. It prevents me from getting lost at "C" so I am calling it "Anchor."
For example. The following program will compile on gcc by piping it through Anchor:
Code:
#include <stdio.h>
int main int c, char **v
while c--
printf "Argument %i is \"%s\"\n",c,v[c]
return 0
It is mostly for C, but should work with PHP and Java as well, since it actually has no clue about the underlying language. It just puts {brackets} around indented sections and adds semicolons everywhere else. Two spaces " " is equivalent to a left paren (and it will add a right paren at an appropriate place at the end of the line even if it continues past several linebreaks). The latter functionality is flaky. You may have to put whitespace at the end of a line to force the parser to ignore that line in a program. Then again, putting accidental whitespace at the end of a line will screw things up. The programmer is only human!
Again, Anchor is free, but because my writing style is that of a marketer and the spam filter is so huge around here. You will have to find it yourself.
Just get on Freshmeat DOT net and look around for Anchor and let me know what you think. Improvements (patches) welcome!