appleseedlab / superc

The SuperC Parsing Framework
25 stars 4 forks source link

More optimal merging of list semantic values #158

Open paulgazz opened 3 years ago

paulgazz commented 3 years ago

Per @kaarthikalagappan 's observation, try merging list semantic values by joining their lists of children, instead of wrapping the lists under separate static conditionals.

        } else if (/* the semantic value is a list */ false) {
          /*
            check whether it's a list using, with the caveat that
            using a name change annotation will prevent this from
            working properly.  (we could add a check to prohibit name
            changes for list nodes.)

            SemanticValues.ValueType valueType = semanticValues.getValueType(nodeName);  // really should take grammar symbol

            assert(this.value.nodename == other.value.nodename)
            assert(not null, children not null)

            if valueType == SemanticValues.ValueType.LIST

            this.value.node.addAll(other.value.children);  // take one semantic, this.value, and all the elements from the other.value to it
           */

Add this to case 3 of the stackframe merge function.