Package PyUtil.assembler


Classes

class  pat
class  AssemblerException

Functions

def pred
def star
def seq
def disj
def treat
def pretreat
def plus
def zo1
def vgen

Variables

tuple any = pred(lambda x:True)

Detailed Description

Combinator based assemblers for generators (streams)

In general, an assembler has this type:

stream -> (val, stream)

where stream is the initial input stream, and the result stream
is the 'remainder' after the assembly


Function Documentation

def PyUtil.assembler.disj (   asms  ) 

assembler that produces 1st valid assembly from a list of
assemblers

Definition at line 98 of file assembler.py.

def PyUtil.assembler.plus (   a  ) 

given an assembler a, return the Kleene '+' operation.
Kleene '+' = seq(a,star(a)), but the return value should still
be a list of values

Definition at line 139 of file assembler.py.

def PyUtil.assembler.pred (   p  ) 

produce an assembler based on predicate p
if p(stream.next()), then return that value, otherwise AssemblerException

Definition at line 46 of file assembler.py.

def PyUtil.assembler.pretreat (   a,
  ff 
)

Definition at line 129 of file assembler.py.

def PyUtil.assembler.seq (   asms  ) 

assembler that produces a sequence of assemblies

Definition at line 79 of file assembler.py.

def PyUtil.assembler.star (   a  ) 

assembler that repeatedly applies asm a to the stream

NOTE: 0 applications is ok (still assembles)

Definition at line 63 of file assembler.py.

def PyUtil.assembler.treat (   a,
  ff 
)

Given an assembler a, and a list of functions *ff, apply each function in the list
to the assembler a return value, and return the value of the applications
as the return value of the treated assembler.

Definition at line 114 of file assembler.py.

def PyUtil.assembler.vgen (   a,
  src 
)

for a given assembler a, and source stream src
vgen is a returns generator that yields a stream of a-assemblies
from src, until src is exhausted

Definition at line 159 of file assembler.py.

def PyUtil.assembler.zo1 (   a  ) 

implement the '?' operator of classical regexp
engines. That is, 0 or 1 occurrences of a

Definition at line 146 of file assembler.py.


Variable Documentation

tuple PyUtil::assembler.any = pred(lambda x:True)

Definition at line 61 of file assembler.py.


Generated on Wed Jan 28 02:46:57 2009 for OpenADFortTk (SourceProcessing) by  doxygen 1.5.7.1