Package org.antlr.v4.tool

Examples of org.antlr.v4.tool.Grammar


    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A{;} | B ;");
    int decision = 0;
    checkPredictedAlt(lg, g, decision, "a", 1);
    checkPredictedAlt(lg, g, decision, "b", 2);
View Full Code Here


    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A | ;");
    int decision = 0;
    checkPredictedAlt(lg, g, decision, "a", 1);
    checkPredictedAlt(lg, g, decision, "", 2);
View Full Code Here

    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A | A B ;");
    checkPredictedAlt(lg, g, 0, "a", 1);
    checkPredictedAlt(lg, g, 0, "ab", 2);
    checkPredictedAlt(lg, g, 0, "abc", 2);
View Full Code Here

    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : x | y ;\n" +
      "x : A ;\n" +
      "y : B ;\n");
    int decision = 0;
View Full Code Here

    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {A,B,C}\n" +
      "a : x B ;\n" +
      "b : x C ;\n" +
      "x : A | ;\n");
View Full Code Here

    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A | A | A B ;");
    int decision = 0;
    checkPredictedAlt(lg, g, decision, "a", 1);
    checkPredictedAlt(lg, g, decision, "ab", 3);
View Full Code Here

    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A B | A B | A B C ;");
    int decision = 0;
    checkPredictedAlt(lg, g, decision, "ab", 1);
    checkPredictedAlt(lg, g, decision, "abc", 3);
View Full Code Here

      "C : 'c' ;\n" +
      "LP : '(' ;\n" +
      "RP : ')' ;\n" +
      "INT : '0'..'9'+ ;\n"
    );
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {A,B,C,LP,RP,INT}\n" +
      "a : e B | e C ;\n" +
      "e : LP e RP\n" +
      "  | INT\n" +
View Full Code Here

      "C : 'c' ;\n" +
      "LP : '(' ;\n" +
      "RP : ')' ;\n" +
      "INT : '0'..'9'+ ;\n"
    );
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {A,B,C,LP,RP,INT}\n" +
      "a : e A | e A B ;\n" +
      "e : LP e RP\n" +
      "  | INT\n" +
View Full Code Here

      "lexer grammar L;\n" +
      "ID : 'a'..'z' ;\n" + // one char
      "SEMI : ';' ;\n"+
      "INT : '0'..'9'+ ;\n"
    );
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {ID,SEMI,INT}\n" +
      "a : (ID | ID ID?) SEMI ;");
    int decision = 1;
    checkPredictedAlt(lg, g, decision, "a;", 1);
View Full Code Here

TOP

Related Classes of org.antlr.v4.tool.Grammar

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.