Python Front-end to GCC

Ned Batchelder ned at nedbatchelder.com
Tue Oct 22 14:23:22 EDT 2013


On 10/22/13 2:16 PM, Mark Janssen wrote:
>>>>> So which of you is confused?  I ask that in the inclusive (not
>>>>> exclusive OR) sense.... ;^)  <-- face says "both".
>>>> Could you please be less snarky?
>>> Okay.  The purpose of BNF (at least as I envision it) is to
>>> produce/specify a *context-free* "grammar".  A lexer parses the tokens
>>> specified in the BNF into an Abstract Syntax Tree.  If one can produce
>>> such a tree for any given source, the language, in theory, can be
>>> compiled by GCC into an executable.
>>>
>>> Boom.
>> Hmm, I don't hear the boom yet.  An Abstract Syntax Tree is a tree
>> representation of a program.  To use my previous example: the program "123
>> *!? 456" would become a tree:
>>
>>      op: "*!?"
>>          num: 123
>>          num: 456
>>
>> There's still not enough information to compile this.
> ....Is your language Turing complete?
>

1) No, it's not.
2) So what?  That should make it easier to compile to C, if anything.
3) Don't change the subject.

A BNF doesn't provide enough information to compile a program to C. 
That's all I'm trying to help you understand.  If you don't agree, then 
we have to talk about the meaning of the words BNF, compile, program, and C.

I applaud your interest in this topic.  I think you need to learn more 
before you try to claim expertise, though.

--Ned.



More information about the Python-list mailing list