help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: indentations instead of endtag in a grammar


From: tys lefering
Subject: Re: indentations instead of endtag in a grammar
Date: Wed, 17 Feb 2010 16:49:54 +0100
User-agent: SquirrelMail/1.4.18

> @ Istvan is it possible that u send me the *.l & *.y files for python
> Or post a link. Always when i search for python and .y or bison i just
> find links to PyBison or PLY but no bison and lex file for Python.

The python grammar is in the python source tree in
directory Grammar, file Grammar.

The python indenting is in the grammar in line 80:
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT

This is not a yacc or bison grammar because python
has its own internal parser generator pgen in the
directory Parser.

The routine tok_get() in tokenizer.c generates
the INDENT and DEDENT tokens for the parser.

The parser generator source is in pgenmain.c

Output of this parser generator is graminit.c .h:
http://svn.python.org/view/python/trunk/Python/graminit.c?view=markup
http://svn.python.org/view/python/trunk/Include/graminit.h?view=markup

Here are the links to the python grammar and pgen:
http://svn.python.org/view/python/trunk/Grammar/
http://svn.python.org/view/python/trunk/Parser/

The python source as tar.gz is here:
http://www.python.org/download/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]