PSGPars (version 0.1)
index
/Users/dcavar/Documents/Teaching/DGfS Herbstschule 2005/Code/Charty/PSGPars.py

PSGPars.py
This is a storage and parser class for context free grammars
written in the format of reproduction or replacement rules.
 
 
(C) 2002, 2003 by Damir Cavar <dcavar@indiana.edu>
 
This code is written and distributed under the
GNU General Public License which means that its
source code is freely-distributed and available
to the general public.
 
See http://www.gnu.org/copyleft/gpl.html for details
on the license or the the file gpl.txt that should always be
distributed with this code.
 
 
A parser for context free Phrase Structure Grammars (PSG).
The grammars are restricted to:
a. only one non-terminal on the left side of a rule:
   N -> x y z
b. Non-terminals and terminals on the right side
 
Rules are read in with the following constraints:
i.   it is assumed that all elements on the left side of a rule
     are non-terminals
ii.  all elements that are not in the set of non-terminals
     (appear on the right side, but never on the left side) are
     assumed to be terminals
 
 
This code can be opimized. However, its main purpose is to help
students understand how simple chart parsing works. If there are any bugs,
please let me know: Damir Cavar <dcavar@indiana.edu>

 
Modules
       
re
string

 
Classes
       
PSG

 
class PSG
    A Phrase Structure Grammar parser and storage class.
 
  Methods defined here:
__init__(self, filename)
getTag(self, word)
load(self, filename)

Data and other attributes defined here:
lhs = []
lhshash = {}
nonterminals = []
regexp_nont = <_sre.SRE_Pattern object at 0x2cf20>
regexp_t = <_sre.SRE_Pattern object at 0xa52e0>
rhs = []
rhshash = {}
terminals = []

 
Data
        __author__ = 'Damir Cavar'
__version__ = '0.1'

 
Author
        Damir Cavar