Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(at': 0.04; 'source,': 0.04; 'syntax': 0.04; 'tree': 0.05; 'subject:Python': 0.06; '22,': 0.09; 'cc:addr:python-list': 0.11; 'language,': 0.12; 'language.': 0.14; '"in': 0.16; '12:50': 0.16; 'cc:name:python list': 0.16; 'denotes': 0.16; 'entry:': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'janssen': 0.16; 'lexer': 0.16; 'quite.': 0.16; 'syntactic': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'written': 0.21; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'source': 0.25; 'compiled': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'cc:2**2': 0.30; 'characters': 0.30; 'specified': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'gcc': 0.31; 'node': 0.31; 'produces': 0.31; 'subject:end': 0.31; 'received:google.com': 0.35; 'science,': 0.36; 'pm,': 0.38; 'structure': 0.39; 'skip:* 10': 0.61; 'such': 0.63; 'to:addr:gmail.com': 0.65; 'parser,': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=uaa8qe5PnsO4f0LYGetLU0awP+IcrjAFw0QwKHqq+SQ=; b=qmSyAPNJ0yN+Mw+C7XdvMpIJ1k4jDzzNxwPL4XXQrpyfuQ0/fBigO/RSzuTeeY/QTv XcybZ+E2WN6Ct1yyFS4SldGaMtBpXWs4Bf5D3kCV65gqofJ2lbX1fvVTO1euMusroQKN dGlvZpXgGyTXng9C0yD591ZlzDJaKPXWA4TC6TnP8HMfiTIGVhNDufFjNQQ82EbwHaN+ marEa7wQ02Ky/tXvLHIWadCTaPHKynVM5jGRDw0ixZKquuDLToNDYmn9YUr45d9y9Vo7 nMYGucyoWbOg5X2J+4pzeVQu8AlrhSnkIpQpmMaJE1PzL7HWtfLPwAo3MYfUC1Ukv0mn wedw== MIME-Version: 1.0 X-Received: by 10.42.215.11 with SMTP id hc11mr2217033icb.47.1382465322507; Tue, 22 Oct 2013 11:08:42 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: References: <4012031f-5334-4be8-a673-e0d8c8917fb2@googlegroups.com> <5a4e0ec9-c977-4a86-83b0-9f4c55a82e37@googlegroups.com> <54f8eb09-7a2e-4306-86f2-7ae118fa8055@googlegroups.com> <52669DC3.5010601@nedbatchelder.com> Date: Tue, 22 Oct 2013 13:08:42 -0500 X-Google-Sender-Auth: rmHdkF43wxOe31SGDWQMfR4Pmvo Subject: Re: Python Front-end to GCC From: Skip Montanaro To: Mark Janssen Content-Type: text/plain; charset=UTF-8 Cc: Python List , Dave Angel , Steven D'Aprano X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382465327 news.xs4all.nl 15968 [2001:888:2000:d::a6]:57219 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57287 On Tue, Oct 22, 2013 at 12:50 PM, Mark Janssen wrote: > 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. Well, not quite. The lexer breaks the stream of characters up into tokens, which are fed to the parser, which produces an abstract syntax tree. From the WIkipedia entry: "In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code." Skip