Examples of SymbolSet


Examples of joust.utils.data.SymbolSet

        log.trace("Entering special assignment effects routine for {}", that);
        // TODO: This routine is almost comically inefficient.
        // Construct an EffectSet for "Writes everything read by the lhs".
        EffectSet lhsEffects = that.lhs.effects.getEffectSet();

        SymbolSet readEscaping = lhsEffects.readEscaping == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readEscaping);
        SymbolSet readInternal = lhsEffects.readInternal == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readInternal);

        EffectSet newEffects = new EffectSet((readEscaping.isEmpty() ? 0 : EffectType.WRITE_ESCAPING.maskValue)
                                           | (readInternal.isEmpty() ? 0 : EffectType.WRITE_INTERNAL.maskValue));

        newEffects.writeEscaping = readEscaping;
        newEffects.writeInternal = readInternal;

        that.effects = Effects.unionWithDirect(newEffects, that.rhs.effects);
View Full Code Here

Examples of joust.utils.data.SymbolSet

        log.trace("Entering special assignment effects routine for {}", that);
        // TODO: This routine is almost comically inefficient.
        // Similar to assign, but we also immediately *read* everything, too.
        EffectSet lhsEffects = that.lhs.effects.getEffectSet();

        SymbolSet readEscaping = lhsEffects.readEscaping == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readEscaping);
        SymbolSet writeEscaping = lhsEffects.readEscaping == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readEscaping);
        SymbolSet readInternal = lhsEffects.readInternal == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readInternal);
        SymbolSet writeInternal = lhsEffects.readInternal == SymbolSet.UNIVERSAL_SET ? SymbolSet.UNIVERSAL_SET : new SymbolSet(lhsEffects.readInternal);

        EffectSet newEffects = new EffectSet((readEscaping.isEmpty() ? 0 : EffectType.WRITE_ESCAPING.maskValue
                                                                         | EffectType.READ_ESCAPING.maskValue)
                                           | (readInternal.isEmpty() ? 0 : EffectType.WRITE_INTERNAL.maskValue
                                                                         | EffectType.READ_INTERNAL.maskValue));
View Full Code Here

Examples of joust.utils.data.SymbolSet

@Log
@ExtensionMethod({Logger.class, LogUtils.LogExtensions.class})
@RunWith(JUnitParamsRunner.class)
public class InvariantExpressionFinderTest extends BaseAnalyserTest<InvariantExpressionFinder> {
    public InvariantExpressionFinderTest() {
        super(InvariantExpressionFinder.class, "invariantExpressions", new SymbolSet(), new SymbolSet());
    }
View Full Code Here

Examples of joust.utils.data.SymbolSet

    public void testLVA(AJCMethodDecl inputTree, Object[] targetNodes, Object[] expectedLives) {
        SymbolSet[] symbolSets = new SymbolSet[expectedLives.length];

        for (int i = 0; i < expectedLives.length; i++) {
            Object[] symbols = (Object[]) expectedLives[i];
            SymbolSet expected = new SymbolSet();
            for (int b = 0; b < symbols.length; b++) {
                expected.add((VarSymbol) symbols[b]);
            }

            symbolSets[i] = expected;
        }
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

    buffer.append(super.toString());
    buffer.append("\n");

    buffer.append("Terminal symbols:\n");
    SymbolSet tsymbols = getSymbols().getTerminals();
    for (int i = 0; i < tsymbols.getSymbolCount(); i++)
    {
      buffer.append(String.valueOf(i));
      buffer.append(".Terminal: ");
      buffer.append(tsymbols.getSymbol(i));
      buffer.append(" Priority=");
      buffer.append(String.valueOf(getPriority((Terminal)tsymbols.getSymbol(i))));
      buffer.append(" Associativity=");
      buffer.append(String.valueOf(getAssociativity((Terminal)tsymbols.getSymbol(i))));
      buffer.append("\n");
    }

    buffer.append("Produktions:\n");
    for (int i = 0; i < getProductionCount(); i++)
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

  {
    this.grammar = grammar;
    this.firstsets = firstsets;
    this.log = log;

    SymbolSet symbols = grammar.getSymbols();

    tsymbols = symbols.getTerminals();
    ntsymbols = symbols.getNonterminals();

    // C = closure( [S'=^S,EOF] )
    IntegerList changedState = new IntegerList()// 0=not changed 1=changed

    addItemSet(getStartItemSet());
    changedState.add(CHANGED);

    boolean mustrepeat = false;
    for (int i = 0; i<getItemSetCount(); i++)
    {
      changedState.set(i, NOTCHANGED);

      ItemSet I = getItemSet(i);

      // J = goto(I,X) add to C, for all nonterminal and terminal symbols X
      // for the non terminal symbols
      SymbolSet nextnonterminals = I.getNextNonterminals();
      for (int j = 0; j<nextnonterminals.getSymbolCount(); j++)
      {
        ItemSet J = I.jump(nextnonterminals.getSymbol(j));

        if (!J.isEmpty())
        {
          int index = indexOfCore(J);
          if (index<0// if C doesn't contain J
          {
            index = addItemSet(J);

            changedState.add(CHANGED);
          }
          else  // otherwise the found state extends through J
          {
            if (getItemSet(index).addItemSet(J))  // if the found state change
            {
              if (index<changedState.getCount())
                changedState.set(index, CHANGED);
              else
                changedState.add(CHANGED);

              if (index<=i// if J before I, and J


                // was changed then must the loop repeat
                mustrepeat = true;
            }
          }

          I.setTransition(nextnonterminals.getSymbol(j), index)// stores the transition for this symbol
        }
      }

      // and for the terminal symbols
      SymbolSet nextterminals = I.getNextTerminals();
      for (int j = 0; j<nextterminals.getSymbolCount(); j++)
      {
        ItemSet J = I.jump(nextterminals.getSymbol(j));

        if (!J.isEmpty())
        {
          int index = indexOfCore(J);
          if (index<0// if C doesn't contain J
          {
            index = addItemSet(J);

            changedState.add(CHANGED);
          }
          else  // otherwise the found state extends through J
          {
            if (getItemSet(index).addItemSet(J))  // if the found state change
            {
              if (index<changedState.getCount())
                changedState.set(index, CHANGED);
              else
                changedState.add(CHANGED);

              if (index<=i// if J before I, and J


                // was changed then must the loop repeat
                mustrepeat = true;
            }
          }

          I.setTransition(nextterminals.getSymbol(j), index)// stores the transition for this symbol
        }
      }
    }

    do
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

    for (int i = 0; i<elementCount; i++)
      if ((productions[i]==production) && (positions[i]==position))
      {
        if (lookaheads[i]==null)
          lookaheads[i] = new SymbolSet();

        return lookaheads[i].addSymbol(lookahead);
      }

    ensureCapacity(elementCount+1);
    productions[elementCount] = production;
    positions[elementCount] = position;
    lookaheads[elementCount] = new SymbolSet();
    lookaheads[elementCount++].addSymbol(lookahead);

    return true;
  }
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

    for (int i = 0; i<elementCount; i++)
      if ((productions[i]==production) && (positions[i]==position))
      {
        if (this.lookaheads[i]==null)
          this.lookaheads[i] = new SymbolSet();

        return this.lookaheads[i].addSymbol(lookaheads);
      }

    ensureCapacity(elementCount+1);
    productions[elementCount] = production;
    positions[elementCount] = position;
    this.lookaheads[elementCount] = new SymbolSet();
    this.lookaheads[elementCount++].addSymbol(lookaheads);

    return true;
  }
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

    return EMPTYLIST;
  }

  public SymbolSet getNextTerminals()
  {
    SymbolSet set = new SymbolSet();

    SymbolList productiondefinition;
    for (int item = 0; item<elementCount; item++)
      if ((positions[item]<((productiondefinition =
                            grammar.getProduction(productions[item]).getDefinition()).getSymbolCount())) &&
          (productiondefinition.getSymbol(positions[item]) instanceof Terminal))
        set.addSymbol(productiondefinition.getSymbol(positions[item]));

    return set;
  }
View Full Code Here

Examples of net.sourceforge.chaperon.model.symbol.SymbolSet

    return set;
  }

  public SymbolSet getNextNonterminals()
  {
    SymbolSet set = new SymbolSet();

    SymbolList productiondefinition;
    for (int item = 0; item<elementCount; item++)
      if ((positions[item]<((productiondefinition =
                            grammar.getProduction(productions[item]).getDefinition()).getSymbolCount())) &&
          (productiondefinition.getSymbol(positions[item]) instanceof Nonterminal))
        set.addSymbol(productiondefinition.getSymbol(positions[item]));

    return set;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.