Adam Smith Adam Smith - 1 year ago 107
C Question

What alternative syntax exist for C/C++? (think SPECS or Mirah)

I wondered if there are any simpler or more powerful syntax for C or C++. I have already come across SPECS. That is an alternative syntax for C++. But are there any others and what about C?

It could also be a sort of code generator so that things like functors could be defined less verbosely. I imagine it could be made as a code generator that compiles to C or C++ code which is very similar to the code you wrote in the alternative syntax.

Mirah is an example of doing this for Java.

Ideally I would want to write C in Go like syntax. I like how they fixed switch-case, and in general made everything much less verbose.

Answer Source

The only general-purpose tool that I'm aware of is Lazy C++, which lets you create a single .lzz source file from which it can generate the .h and .cpp files.

There are also numerous approaches to doing code generation for C++. (For examples, see Cog, Pump, or Wikipedia's list.) These aren't full-fledged alternate syntaxes, but they can help with particular categories of syntax (such as automatically generating templates taking 1 to N arguments, to work around the lack of variadic templates).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download