Python Front-end to GCC

Mark Janssen dreamingforward at gmail.com
Sat Oct 26 17:25:29 EDT 2013


[Getting back to some old comments....]

>>> 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.

Computer Science 301 (a.k.a. "educating the python brogrammers who've
been too long using interpreted languages"):

C source ("blah.c") is broken down into a linear sequence of tokens
fed into a parser.  The BNF definition for C takes those tokens/syntax
and produces a lexical graph of the source -- its grammatical form.
This becomes an abstract syntax *tree* because there is a "main"
function (without which I don't believe you can call a language
formally "Turing Complete" because one doesn't know where to begin to
feed the machine (wait for it.... boom)).  In any case, this *roots*
the abstract lexical graph and forms the basis for compiling into
machine code.

>  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.

Well, now you're confusing everybody, because you're asking, in
essence: "what is the meaning of a symbol to a computer?", and since
there isn't one, then you should wonder: "how are you going to get it
to 'do the right thing?'"  For that, you'll have to take Mark
Janssen's PHIL 444: "Epistemics of Quantity" (not offered from the
internet).

Now, please give credit to all the old-timers who paved the way for
all you to be partying in the easy-land of high-level languages like
Python.  It's them who made the computer SCIENCE.  You guys have been
so spoiled, you're taking it all for granted and confusing people with
all your claptrap about TYPES.  The insane cannot tell that they're
insane.  Remember that.

> 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.

I will look forward to how you will give a semantic specification for
the C token "{": left bracket.

Apologies will be accepted on the list.

Mark J



More information about the Python-list mailing list