Package lemon :: Package external :: Package gadfly :: Module kjParseBuild
[show private | hide private]
[frames | no frames]

Module lemon.external.gadfly.kjParseBuild

Python code for building a parser from a grammar

:Author: Aaron Watters
:Maintainers: http://gadfly.sf.net/
:Copyright: Aaron Robert Watters, 1994
:Id: $Id: kjParseBuild.py,v 1.1 2003/08/12 09:17:12 thejimmyg Exp $:

Classes
CFSMachine a derived FSM class, with closure computation methods defined...
CGrammar a derived grammar class this is a compilable grammar for automatic parser generation.
codeReconstruct grammar reconstruction to a file...
marshalReconstruct Reconstruction using marshalling to a file encodes internal structures for grammar using marshal-able objects.
Reconstruct Grammar reconstruction objects encapsulate the process of grammar archiving.
Ruleset Ruleset class, used to compute NFA and then DFA for parsing based on a list of rules.

Function Summary
  FullBody(list, ObjectGram)
FullBody should receive [ string, Bodylist] must determine whether the string represents a keyword, a nonterminal, or a terminal of the object grammar.
  FullRuleList(list, ObjectGram)
FullRuleList should receive list of form...
  GrammarDumpSequence(ReconstructObj)
general procedure for different types of archiving for grammars...
  IdentFun(string)
for identifiers simply return the string...
  InterpNonTerm(list, ObjectGram)
InterpNonTerm should receive...
  InterpRule(list, ObjectGram)
InterpRule should receive list of form...
  InterpRuleName(list, ObjectGram)
InterpRuleName should receive...
  NullBody(list, ObjectGram)
NullBody should receive []...
  NullCGrammar()
function to create a "null CGrammar"...
  NullRuleList(list, ObjectGram)
NullRuleList should receive list of form []...
  RootReduction(list, ObjectGram)
RootReduction should receive list of form...
  ruleGrammar()
function to generate a grammar for parsing grammar rules...

Variable Summary
int ABORTONERROR = 0                                                                     
str COLKEY = '::'
str COMMENTFORM = '##.*\n'
str IDFORM = '[^\t\n\x0b\x0c\r ]+'
str IDNAME = 'ident'
str LTKEY = '>>'
tuple NULLTOKEN = (None, None)
str PMODULE = 'gadfly.kjParser'
str RSKEY = '@R'
Grammar RULEGRAM = <lemon.external.gadfly.kjParser.Grammar insta...

Function Details

FullBody(list, ObjectGram)

FullBody should receive
 [ string, Bodylist]
must determine whether the string represents
a keyword, a nonterminal, or a terminal of the object
grammar.
returns (KEYFLAG, string) (TERMFLAG, string) or
        (NONTERMFLAG, string) respectively

FullRuleList(list, ObjectGram)

FullRuleList should receive list of form
[ Rule, RuleList ]

GrammarDumpSequence(ReconstructObj)

general procedure for different types of archiving for grammars

IdentFun(string)

for identifiers simply return the string

InterpNonTerm(list, ObjectGram)

InterpNonTerm should receive
[ string ]

InterpRule(list, ObjectGram)

InterpRule should receive list of form
[keyword RSKEY,
 RuleNameStr,
 keyword COLKEY,
 Nontermtoken,
 keyword LTKEY,
 Bodylist]

InterpRuleName(list, ObjectGram)

InterpRuleName should receive
[ string ]

NullBody(list, ObjectGram)

NullBody should receive []

NullCGrammar()

function to create a "null CGrammar"

NullRuleList(list, ObjectGram)

NullRuleList should receive list of form []

RootReduction(list, ObjectGram)

RootReduction should receive list of form
[ nontermtoken, keyword COLKEY, RuleList ]

ruleGrammar()

function to generate a grammar for parsing grammar rules

Variable Details

ABORTONERROR

Type:
int
Value:
0                                                                     

COLKEY

Type:
str
Value:
'::'                                                                   

COMMENTFORM

Type:
str
Value:
'''##.*
'''                                                                    

IDFORM

Type:
str
Value:
'''[^\t
\x0b\x0c\r ]+'''                                                       

IDNAME

Type:
str
Value:
'ident'                                                                

LTKEY

Type:
str
Value:
'>>'                                                                   

NULLTOKEN

Type:
tuple
Value:
(None, None)                                                           

PMODULE

Type:
str
Value:
'gadfly.kjParser'                                                      

RSKEY

Type:
str
Value:
'@R'                                                                   

RULEGRAM

Type:
Grammar
Value:
<lemon.external.gadfly.kjParser.Grammar instance at 0x0165FAF8>        

Generated by Epydoc 2.0 on Mon Nov 10 15:08:21 2003 http://epydoc.sf.net