1. 06 Kas, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      Change the graph structure to contain the code generator object for · 314e3fb2
      Jeremy Hylton yazdı
      embedded code objects (e.g. functions) rather than the generated code
      object.  This change means that the compiler generates code for
      everything at the end, rather then generating code for each function
      as it finds it.  Implementation note: _convert_LOAD_CONST in
      pyassem.py must be change to call getCode().
      
      Other changes follow.  Several changes creates extra edges between
      basic blocks to reflect control flow for loops and exceptions.  These
      missing edges had gone unnoticed because they do not affect the
      current compilation process.
      
      pyassem.py:
          Add _enable_debug() and _disable_debug() methods that print
          instructions and blocks to stdout as they are generated.
      
          Add edges between blocks for instructions like SETUP_LOOP,
          FOR_LOOP, etc.
      
          Add pruneNext to get rid of bogus edges remaining after
          unconditional transfer ops (e.g. JUMP_FORWARD)
      
          Change repr of Block to omit block length.
      
      pycodegen.py:
          Make sure a new block is started after FOR_LOOP, etc.
      
          Change assert implementation to use RAISE_VARARGS 1 when there is
          no user-specified failure output.
      
      misc.py:
          Implement __contains__ and copy for Set.
      314e3fb2
  2. 13 Eki, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      Now supports entire Python 2.0 language and still supports Python · 9c048f9f
      Jeremy Hylton yazdı
      1.5.2.  The compiler generates code for the version of the interpreter
      it is run under.
      
      ast.py:
          Print and Printnl add dest attr for extended print
          new node AugAssign for augmented assignments
          new nodes ListComp, ListCompFor, and ListCompIf for list
              comprehensions
      
      pyassem.py:
          add work around for string-Unicode comparison raising UnicodeError
              on comparison of two objects in code object's const table
      
      pycodegen.py:
          define VERSION, the Python major version number
          get magic number using imp.get_magic() instead of hard coding
          implement list comprehensions, extended print, and augmented
              assignment; augmented assignment uses Delegator classes (see
              doc string)
          fix import and tuple unpacking for 1.5.2
      
      transformer.py:
          various changes to support new 2.0 grammar and old 1.5 grammar
          add debug_tree helper than converts and symbol and token numbers
          to their names
      9c048f9f
  3. 12 Eki, 2000 1 kayıt (commit)
  4. 01 Eyl, 2000 2 kayıt (commit)
  5. 12 Agu, 2000 1 kayıt (commit)
    • Thomas Wouters's avatar
      Bring Tools/compiler almost up to date. Specifically: · 46cc7c0f
      Thomas Wouters yazdı
      - fix tab space issues (SF patch #101167 by Neil Schemenauer)
      - fix co_flags for classes to include CO_NEWLOCALS (SF patch #101145 by Neil)
      - fix for merger of UNPACK_LIST and UNPACK_TUPLE into UNPACK_SEQUENCE,
        (SF patch #101168 by, well, Neil :)
      - Adjust bytecode MAGIC to current bytecode.
      
      TODO: teach compile.py about list comprehensions.
      46cc7c0f
  6. 04 Agu, 2000 1 kayıt (commit)
  7. 02 May, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      patches from Mark Hammond · be317e61
      Jeremy Hylton yazdı
      Attached is a set of diffs for the .py compiler that adds support
      for the new extended call syntax.
      
      compiler/ast.py:
      CallFunc node gets 2 new children to support extended call syntax -
      "star_args" (for "*args") and "dstar_args" (for "**args")
      
      compiler/pyassem.py
      It appear that self.lnotab is supposed to be responsible for
      tracking line numbers, but self.firstlineno was still hanging
      around.  Removed self.firstlineno completely.  NOTE - I didnt
      actually test that the generated code has the correct line numbers!!
      
      Stack depth tracking appeared a little broken - the checks never
      made it beyond the "self.patterns" check - thus, the custom methods
      were never called!  Fixed this.
      
      (XXX Jeremy notes: I think this code is still broken because it
      doesn't track stack effects across block bounaries.)
      
      Added support for the new extended call syntax opcodes for depth
      calculations.
      
      compiler/pycodegen.py
      
      Added support for the new extended call syntax opcodes.
      
      compiler/transformer.py
      
      Added support for the new extended call syntax.
      be317e61
  8. 16 Mar, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      complete rewrite · 36cc6a21
      Jeremy Hylton yazdı
      code generator uses flowgraph as intermediate representation.  the old
          rep uses a list with explicit "StackRefs" to indicate the target
          of jumps.
      
      pyassem converts flowgraph to bytecode, breaks up individual steps of
          generating bytecode
      36cc6a21
  9. 06 Mar, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      rename compile.py to pycodegen.py · 7fab23e9
      Jeremy Hylton yazdı
      fix imports
      remove parse functions and visitor code
      track name change: Classdef to Class
      
      add some comments and tweak order of visitXXX methods
      
      get rid of if __name__ == "__main__ section
      7fab23e9
  10. 17 Şub, 2000 2 kayıt (commit)
    • Jeremy Hylton's avatar
      the previous quick hack to fix def foo((x,y)) failed on some cases · 3ec7e2c4
      Jeremy Hylton yazdı
      (big surprise).  new solution is a little less hackish.
      
      Code gen adds a TupleArg instance in the argument slot. The tuple arg
      includes a copy of the names that it is responsble for binding.  The
      PyAssembler uses this information to calculate the correct argcount.
      
      all fix this wacky case: del (a, ((b,), c)), d
      which is the same as: del a, b, c, d
      (Can't wait for Guido to tell me why.)
      
      solution uses findOp which walks a tree to find out whether it
      contains OP_ASSIGN or OP_DELETE or ...
      3ec7e2c4
    • Jeremy Hylton's avatar
      satisfy the tabnanny · 873bdc18
      Jeremy Hylton yazdı
      fix broken references to filename var in generateXXX methods
      873bdc18
  11. 16 Şub, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      support for arglists with implicit tuple unpacks · ad9a86fb
      Jeremy Hylton yazdı
      - added a number of support methods to generate code just before the
        body
      - hack protocol for communicating number of args to PyAssembler
      
      fix TryExcept generation for case where exception handler has no body
      fix visitAssAttr
      add comment about incomplete visitAssName
      
      stop using the ExampleASTVisitor
      
      change script invocation to accept a list of .py files (e.g. Lib/*.py)
      ad9a86fb
  12. 15 Şub, 2000 1 kayıt (commit)
  13. 14 Şub, 2000 4 kayıt (commit)
  14. 12 Şub, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      change MODULE_NAMESPACE/FUNCTION_NAMESPACE stuff to have a single flag · 3050d515
      Jeremy Hylton yazdı
      named OPTIMIZED, which matches compile.c and makes more sense for
      classes
      
      revamp call signature for PythonVMCode.__init__; doesn't really matter
      'cuz this code is going to be refactored out of existence
      
      add generateClassCode and modify Func & Lambda generation
      
      add support for nodes Classdef, Keyword,
      
      fix CallFunc to generate right op arg when calling w/ keywords
      
      add ugly hack to properly compute offsets when the same stack ref is
      used multiple times
      3050d515
  15. 11 Şub, 2000 1 kayıt (commit)
    • Jeremy Hylton's avatar
      add support for Lambda nodes · 76d01b82
      Jeremy Hylton yazdı
      change resolution of local name ops (LOAD_FAST).  i think it makes
      sense now.  if it is an argument or a local var name that it used, it
      must be in varnames.  if it is a local var name that is used, it must
      also be in names
      76d01b82
  16. 10 Şub, 2000 3 kayıt (commit)
    • Jeremy Hylton's avatar
      add loop handling via · 4eb504c2
      Jeremy Hylton yazdı
      Loop object to handle StackRegs
      loops stack attr on CodeGenreeator to hold the current loop object
      
      add support for nodes While, Break, Continue
      4eb504c2
    • Jeremy Hylton's avatar
      add namespace attr to CodeGenerator, can be either MODULE_NAMESPACE or · 3e0910c1
      Jeremy Hylton yazdı
      FUNCTION_NAMESPACE.  initialize in __init__ and reset in
      generateFunctionCode.
      
      replace direct issue of STORE_FAST, STORE_GLOBAL, etc. with call to
      storeName; same for loadName and deleteName
      
      the new {store,load,delete}Name methods use the namespace attr and the
      local variable stack to determine the correct bytecode to issue
      3e0910c1
    • Jeremy Hylton's avatar
      add ExampleASTVisitor: · 5e0ce53e
      Jeremy Hylton yazdı
      * prints out examples of nodes that are handled by visitor.  simply a
        development convenience
      
      remove NestedCodeGenerator -- it was bogus after all
      replace with generateFunctionCode, a method to call to generate code
        for a function instead of a top-level module
      
      fix impl of visitDiscard (most pop stack)
      emit lineno for pass
      
      handle the following new node types: Import, From, Getattr, Subscript,
      Slice, AssAttr, AssTuple, Mod, Not, And, Or, List
      
      LocalNameFinder: remove names declared as globals for locals
      
      PythonVMCode: pass arg names to constructor, force varnames to contain
      them all (even if they aren't referenced)
      
      add -q option on command line to disable stdout
      5e0ce53e
  17. 08 Şub, 2000 2 kayıt (commit)
    • Jeremy Hylton's avatar
      add optional verbose arg to walk function. it overrides the global · 40245602
      Jeremy Hylton yazdı
      VERBOSE setting for the ASTVisitor
      
      add getopt handling for one or more -v args
      
      rename ForwardRef to StackRef, because it isn't necessarily directional
      
      CodeGenerator:
      * add assertStackEmpty method.  prints warning if stack is not empty
        when it should be
      * define methods for AssName, UNARY_*, For
      
      PythonVMCode:
      * fix mix up between hasjrel and hasjabs for address calculation
      40245602
    • Jeremy Hylton's avatar
      now produces valid pyc files for a least a trivial subset of the · 53187f32
      Jeremy Hylton yazdı
      language.
      
      CodeGenerator:
      * modify to track stack depth
      * add emit method that call's PythonVMCode's makeCodeObject
      * thread filenames through in hackish way
      * set flags for code objects for modules and functions
        XXX the docs for the flags seem out of date and/or incomplete
      
      PythonVMCode:
      * add doc string describing the elements of a real code object
      
      LineAddrTable:
      * creates an lnotab (no quite correctly though)
      53187f32
  18. 04 Şub, 2000 2 kayıt (commit)
    • Jeremy Hylton's avatar
      rapid evolution towards producing real .pyc files (even though I don't · 0fdffcf9
      Jeremy Hylton yazdı
      handle most of the language syntax yet)
      
      create NestedCodeGenerator used to generator the separate code object
      that needs to be passed as an argument to MAKE_FUNCTION when a def
      stmt is found (probably useful for class too)
      
      change CodeGenerator.visitFunction to use the NestedCG
      
      add CompiledModule class to handle creation of .pyc (pretty minimal
      for now)
      
      add makeCodeObject method to PythonVMCode that replaces symbolic names
      with indexes into slots of the code code.  the design of this
      class will probably need to be revised.
      0fdffcf9
    • Jeremy Hylton's avatar
      checking in initial weekend's work · 8b6323d3
      Jeremy Hylton yazdı
      compile.py: ASTVisitor framework plus bits of a code generator that
          should be bug-for-buf compatible with compile.c
      
      misc.py: Set and Stack helpers
      
      test.py: a bit of simple sample code that compile.py will work on
      8b6323d3