PRODUCT=11/1/1/ab41
NAME="AT Translated Set 2 keyboard"
PHYS="isa0060/serio0/input0"
PROP=0
EV=120013
KEY=402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe
MSC=10
LED=7
MODALIAS=input:b0011v0001p0001eAB41-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8E,8F,9B,9C,9D,9E,9F,A3,A4,A5,A6,AC,AD,B7,B8,B9,D9,E2,ram4,l0,1,2,sfw
  ,   ˆl–Ým_JJh¥ ² ¸È®2ú˜´oÁ„eÖœk_‡I|¥ŠèªÁÀ ?÷     
.. _compiler:

***********************
Python compiler package
***********************

.. deprecated:: 2.6
   The :mod:`compiler` package has been removed in Python 3.

.. sectionauthor:: Jeremy Hylton <jeremy@zope.com>


The Python compiler package is a tool for analyzing Python source code and
generating Python bytecode.  The compiler contains libraries to generate an
abstract syntax tree from Python source code and to generate Python
:term:`bytecode` from the tree.

The :mod:`compiler` package is a Python source to bytecode translator written in
Python.  It uses the built-in parser and standard :mod:`parser` module to
generate a concrete syntax tree.  This tree is used to generate an abstract
syntax tree (AST) and then Python bytecode.

The full functionality of the package duplicates the built-in compiler provided
with the Python interpreter.  It is intended to match its behavior almost
exactly.  Why implement another compiler that does the same thing?  The package
is useful for a variety of purposes.  It can be modified more easily than the
built-in compiler.  The AST it generates is useful for analyzing Python source
code.

This chapter explains how the various components of the :mod:`compiler` package
work.  It blends reference material with a tutorial.


The basic interface
===================

.. module:: compiler
   :synopsis: Python code compiler written in Python.
   :deprecated:


The top-level of the package defines four functions.  If you import
:mod:`compiler`, you will get these functions and a collection of modules
contained in the package.


.. function:: parse(buf)

   Returns an abstract syntax tree for the Python source code in *buf*. The
   function raises :exc:`SyntaxError` if there is an error in the source code.  The
   return value is a :class:`compiler.ast.Module` instance that contains the tree.


.. function:: parseFile(path)

   Return an abstract syntax tree for the Python source code in the file specified
   by *path*.  It is equivalent to ``parse(open(path).read())``.


.. function:: walk(ast, visitor[, verbose])

   Do a pre-order walk over the abstract syntax tree *ast*.  Call the appropriate
   method on the *visitor* instance for each node encountered.


.. function:: compile(source, filename, mode, flags=None,  dont_inherit=None)

   Compile the string *source*, a Python module, statement or expression, into a
   code object that can be executed by the exec statement or :func:`eval`. This
   function is a replacement for the built-in :func:`compile` function.

   The *filename* will be used for run-time error messages.

   The *mode* must be 'exec' to compile a module, 'single' to compile a single
   (interactive) statement, or 'eval' to compile an expression.

   The *flags* and *dont_inherit* arguments affect future-related statements, but
   are not supported yet.


.. function:: compileFile(source)

   Compiles the file *source* and generates a .pyc file.

The :mod:`compiler` package contains the following modules: :mod:`ast`,
:mod:`consts`, :mod:`future`, :mod:`misc`, :mod:`pyassem`, :mod:`pycodegen`,
:mod:`symbols`, :mod:`transformer`, and :mod:`visitor`.


Limitations
===========

There are some problems with the error checking of the compiler package.  The
interpreter detects syntax errors in two distinct phases.  One set of errors is
detected by the interpreter's parser, the other set by the compiler.  The
compiler package relies on the interpreter's parser, so it get the first phases
of error checking for free.  It implements the second phase itself, and that
implementation is incomplete.  For example, the compiler package does not raise
an error if a name appears more 