Python Front-end to GCC

Skip Montanaro skip at pobox.com
Tue Oct 22 14:08:42 EDT 2013


On Tue, Oct 22, 2013 at 12:50 PM, Mark Janssen
<dreamingforward at gmail.com> 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



More information about the Python-list mailing list