On 22/10/2013 00:24, Mark Janssen wrote: >> A language specification in BNF is just syntax. It doesn't say anything >> about semantics. So how could this be used to produce executable C code >> for a program? BNF is used to produce parsers. But a parser isn't >> sufficient. > > A C program is just syntax also. How does the compiler generate > executable machine code? Extrapolate into a Python front-end to C. >
Did you even read the paragraph you quoted above? The BNF specification does NOT completely describe a language, it only defines its syntax. So if the only thing you knew about C was its BNF, you could certainly not write a C compiler. And neither could anyone else. Fortunately for the C community, the language specification included much more than a BNF grammar. At a minimum, you have to specify both the syntax and the semantics. All that has nothing to do with an actual program written in an actually defined language, whether C or Python. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list