Remove list rewrite feature

Issue #141 resolved
Emma Söderberg created an issue

Remove List rewrite feature. This can be done using inherited attributes and a List subclass where applicable and it greatly reduces the number of needed rewrite checks.

Comments (7)

  1. Jesper Öqvist

    Improve CNTA rewrite implementation

    Implicit rewrite attributes for circular NTA rewrites are now generated only on node types that can be rewritten.

    Simplified code generation for circular NTA rewrites.

    Removed list rewrites and staged rewrites.

    Rewrites no longer trigger on child count access (getNumChild(), getNumX()).

    fixes #141 (bitbucket)

    → <<cset cd85109e8b81>>

  2. Jesper Öqvist
    • changed status to open

    I think it was a bad idea to completely remove list rewrites right now. I will add them back, but only in legacy rewrite mode (list rewrites will not work in cnta rewrite mode). I think we should instead make list rewrites deprecated now, and generate warnings if a list rewrite is used.

  3. Jesper Öqvist

    Deprecate list rewrites in legacy rewrite mode

    Reverted removal of list rewrites in legacy rewrite mode.

    A deprecation warning is reported when using list rewrites in legacy rewrite mode. List rewrites cause an error in circular NTA rewrite mode.

    see #141 (bitbucket)

    → <<cset eb487dcda2d2>>

  4. Jesper Öqvist

    This can be done using inherited attributes and a List subclass where applicable and it greatly reduces the number of needed rewrite checks.

    This solution does not work well. For example, this test case illustrates a NullPointerException triggered by evaluating an inherited attribute on an NTA child of a List subtype:

    AList : List;
    B ::= A*;
    A;
    
    aspect Test {
      // NTA on List subtype. Causes problem in inherited evaluation. See below.
      syn nta A AList.implicit() = new A();
    
      inh int A.x();
      eq B.getA(int index).x() = getA(index).y(); // NullPointerException when called from AList.implicit().
    
      syn int A.y() = 3;
    }
    
    // Test null pointer exception when evaluating inherited attribute on
    // NTA child of List subtype.
    // .grammar: { AList : List; B ::= A*; A; }
    // .result=EXEC_PASS
    import static runtime.Test.*;
    
    public class Test {
      public static void main(String[] args) {
        AList list = new AList();
        B b = new B(list);
        try {
          list.implicit().x();
          fail("Expected NullPointerException");
        } catch (NullPointerException e) {
        }
      }
    }
    
  5. Jesper Öqvist

    The above null pointer exception has appeared in ExtendJ where a List subtype called BodyDeclList uses NTA children that cause this type of NullPointerException during type lookup.

  6. Jesper Öqvist

    Removed legacy rewrite mechanism and list rewrites

    • Rewrites are now always generated using the circular NTA mapping.
    • The safeLazy option is now enabled by default.

    fixes #141 (bitbucket) fixes #293 (bitbucket)

    → <<cset 124b0bc0f4a2>>

  7. Jesper Öqvist

    Removed legacy rewrite mechanism and list rewrites

    • Rewrites are now always generated using the circular NTA mapping.
    • The safeLazy option is now enabled by default.

    fixes #141 (bitbucket) fixes #293 (bitbucket)

    → <<cset 7ade56d70d44>>

  8. Log in to comment