Where can I find a lexical spec of python?

Chris Rebert clp2 at rebertia.com
Wed Sep 21 18:53:57 CEST 2011

On Wed, Sep 21, 2011 at 9:33 AM, 程劭非 <csf178 at 163.com> wrote:
> Thanks Thomas.
> I've read the document http://docs.python.org/py3k/reference/lexical_analysis.html
> but I worried it might leak some language features like "tab magic".
> For I'm working on a parser with JavaScript I need a more strictly defined spec.
> Currently I have a highlighter here ->http://shaofei.name/python/PyHighlighter.html
> (Also the lexer  http://shaofei.name/python/PyLexer.html)
> As you can see, I just make its behavior align with CPython, but I'm not sure what the real python lexical grammar is like.
> Does anyone know if there is a lexical grammar spec like other languages(e.g. http://bclary.com/2004/11/07/#annex-a)?

Closest thing would be http://docs.python.org/py3k/reference/grammar.html


More information about the Python-list mailing list