Is there a way to compile C++ to C Code?

The C++ FAQ has a list of possibilities: Is it possible to convert C++ to C?. In short, it says that you can’t expect this to give you particularly readable code. Think of the complexities involved; multiple inheritance, virtual-function resolution, templates, operator overloading, etc., etc. There’s no clean succinct way of expressing these concepts in pure C. If … Read more

What is an example of a lexical error and is it possible that a language has no lexical errors?

A lexical error is any input that can be rejected by the lexer. This generally results from token recognition falling off the end of the rules you’ve defined. For example (in no particular syntax): If you think about a lexer as a finite state machine that accepts valid input strings, then errors are going to … Read more