[pypy-svn] r50300 - pypy/branch/astcompilertests/pypy/interpreter/pyparser

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jan 3 23:26:04 CET 2008


Author: cfbolz
Date: Thu Jan  3 23:26:03 2008
New Revision: 50300

Modified:
   pypy/branch/astcompilertests/pypy/interpreter/pyparser/grammar.py
   pypy/branch/astcompilertests/pypy/interpreter/pyparser/pythonparse.py
Log:
kill dead code


Modified: pypy/branch/astcompilertests/pypy/interpreter/pyparser/grammar.py
==============================================================================
--- pypy/branch/astcompilertests/pypy/interpreter/pyparser/grammar.py	(original)
+++ pypy/branch/astcompilertests/pypy/interpreter/pyparser/grammar.py	Thu Jan  3 23:26:03 2008
@@ -73,32 +73,6 @@
 
 ######################################################################
 
-
-def build_first_sets(rules):
-    """XXX : dead
-    builds the real first tokens set for each rule in <rules>
-
-    Because a rule can be recursive (directly or indirectly), the
-    *simplest* algorithm to build each first set is to recompute them
-    until Computation(N) = Computation(N-1), N being the number of rounds.
-    As an example, on Python2.3's grammar, we need 19 cycles to compute
-    full first sets.
-    """
-    changed = True
-    while changed:
-        # loop while one first set is changed
-        changed = False
-        for rule in rules:
-            # For each rule, recompute first set
-            size = len(rule.first_set)
-            rule.calc_first_set()
-            new_size = len(rule.first_set)
-            if new_size != size:
-                changed = True
-    for r in rules:
-        assert len(r.first_set) > 0, "Error: ot Empty firstset for %s" % r
-        r.reorder_rule()
-
 class AbstractContext(object):
     """Abstract base class. derived objects put
     some attributes here that users can use to save

Modified: pypy/branch/astcompilertests/pypy/interpreter/pyparser/pythonparse.py
==============================================================================
--- pypy/branch/astcompilertests/pypy/interpreter/pyparser/pythonparse.py	(original)
+++ pypy/branch/astcompilertests/pypy/interpreter/pyparser/pythonparse.py	Thu Jan  3 23:26:03 2008
@@ -174,21 +174,3 @@
     parser.build_first_sets()
     parser.keywords = builder.keywords
     return 0
-
-
-## XXX BROKEN
-## def parse_grammar(space, w_src):
-##     """Loads the grammar using the 'dynamic' rpython parser"""
-##     src = space.str_w( w_src )
-##     ebnfbuilder = ebnfparse.parse_grammar_text( src )
-##     ebnfbuilder.resolve_rules()
-##     grammar.build_first_sets(ebnfbuilder.all_rules)
-##     return space.wrap( ebnfbuilder.root_rules )
-
-# XXX Unused?
-def grammar_rules( space ):
-    w_rules = space.newdict()
-    parser = make_pyparser(space.config.objspace.pyversion)
-    for key, value in parser.rules.iteritems():
-        space.setitem(w_rules, space.wrap(key), space.wrap(value))
-    return w_rules



More information about the Pypy-commit mailing list