language-python-0.1.1: Parsing and pretty printing of Python code.

Portabilityghc
Stabilityexperimental
Maintainerbjpop@csse.unimelb.edu.au

Language.Python.Version3.Parser

Contents

Description

A parser for Python version 3 programs. Parsers are provided for modules, statements, and expressions.

See:

Synopsis

Parsing modules

parseModuleSource

Arguments

:: String

The input stream (python module source code).

-> String

The name of the python source (filename or input device).

-> Either ParseError Module

An error or the abstract syntax tree (AST) of the python module.

Parse a whole Python source file.

Parsing statements

parseStmtSource

Arguments

:: String

The input stream (python statement source code).

-> String

The name of the python source (filename or input device).

-> Either ParseError [Statement]

An error or maybe the abstract syntax tree (AST) of zero or more python statements.

Parse one compound statement, or a sequence of simple statements. Generally used for interactive input, such as from the command line of an interpreter.

Parsing expressions

parseExprSource

Arguments

:: String

The input stream (python statement source code).

-> String

The name of the python source (filename or input device).

-> Either ParseError Expr

An error or maybe the abstract syntax tree (AST) of the python expression.

Parse an expression. Generally used as input for the 'eval' primitive.

Parse errors

newtype ParseError Source

Parse error. A list of error messages and a source location.

Constructors

ParseError ([String], SrcLocation) 

Instances