Python Front-end to GCC
Dave Angel
davea at davea.name
Tue Oct 22 00:39:21 EDT 2013
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
More information about the Python-list
mailing list