I\'m writing some C at the moment and because I like whitespace sensitive syntax, I\'d like to write it like this:
#include
int main(void)
If you really want to do this, it is not going to be possible without implementing a language parser, and even then, I am not sure how the coding convention will be for some of the cases in your "new language that looks like C but has no braces". For example, take the following C code:
struct a {
int i;
};
int main(void) {
...
}
You can write it as
struct a
int i
int main(void)
...
But it has to be converted to the original code, not:
struct a {
int i;
} /* Note the missing semicolon! */
int main(void) {
...
}
Also, given the snippets below:
/* declare b of type struct a */
struct a {
int i;
} b;
/* a struct typedef */
typedef struct a {
int i;
} b;
How are you going to specify these in your language?
You seem to not want to use semicolons in your language either. This restricts your code quite a bit, and makes the conversion tool complicated as well, because you can't have continuation lines without extra effort:
i = j +
k;
is legal C, but
i = j + ;
k;
is not.
So first, you need to define the grammar of your "braceless C" more precisely. As others have said, this sort of thing is fraught with peril.