Package lexer

Examples of lexer.RTS


import java.util.*;

class TestRTS {
  public static void main(String args[]) throws Exception {
    RTS r = new RTS();
    if (!r.isEmpty()) {
      throw new Exception("RTS() error");
    }
    int stateNo = 10;
    int startState = 0;
    int finalState = 1;
    String strAlpha = "abc";
    Character symbols[] = { /*0*/ null,
                /*1*/ null,
                /*2*/ new Character('a'),
                /*3*/ null,
                /*4*/ new Character('b'),
                /*5*/ null,
                /*6*/ null,
                /*7*/ null,
                /*8*/ new Character('c'),
                /*9*/ null };
    Integer next1[] = /*0*/ new Integer(2),
              /*1*/ null,
              /*2*/ new Integer(3),
              /*3*/ new Integer(4),
              /*4*/ new Integer(5),
              /*5*/ new Integer(1),
              /*6*/ new Integer(8),
              /*7*/ new Integer(1),
              /*8*/ new Integer(9),
              /*9*/ new Integer(8)};
    Integer next2[] = /*0*/ new Integer(6),
              /*1*/ null,
              /*2*/ null,
              /*3*/ null,
              /*4*/ null,
              /*5*/ null,
              /*6*/ new Integer(7),
              /*7*/ null,
              /*8*/ null,
              /*9*/ new Integer(7)};
    r = new RTS(stateNo, startState, finalState, strAlpha, symbols, next1, next2);
    r.print();

    HashSet set = new HashSet();
    boolean b = r.lambda(0, set);
    System.out.print("lambda(0): "+set+" return: "+b);

    lexer.DFA d = new lexer.DFA(r);
    System.out.print("\nDFA: "+d);

View Full Code Here

TOP

Related Classes of lexer.RTS

Copyright © 2018 www.massapicom. 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.