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"+
      "s : t C ;\n" +
      "t : A{;} | B ;\n",
      lg);
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"+
      "s : t C ;\n" +
      "t : u ;\n" +
      "u : A{;} | B ;\n",
      lg);
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" +
      "s : A? B ;\n",
      lg);

    testInterp(lg, g, "s", "b", "(s b)");
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" +
      "s : (A{;}|B)? C ;\n",
      lg);

    testInterp(lg, g, "s", "c", "(s c)");
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" +
      "s : A* B ;\n",
      lg);

    testInterp(lg, g, "s", "b", "(s b)");
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" +
      "s : (A{;}|B)* C ;\n",
      lg);

    testInterp(lg, g, "s", "c", "(s c)");
View Full Code Here

      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n" +
      "PLUS : '+' ;\n" +
      "MULT : '*' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n" +
      "s : e ;\n" +
      "e : e MULT e\n" +
      "  | e PLUS e\n" +
      "  | A\n" +
View Full Code Here

      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n" +
      "PLUS : '+' ;\n" +
      "MULT : '*' ;\n");
    Grammar g = new Grammar(
      "parser grammar T;\n" +
      "s : e ;\n" +
      "e : e MULT e\n" +
      "  | e PLUS e\n" +
      "  | A\n" +
View Full Code Here

        "PLUS : '+' ;\n" +
        "MULT : '*' ;\n");
  }

  @Test public void testLL1() throws Exception {
    Grammar g = new Grammar(
        "parser grammar T;\n" +
        "s : ';'{}\n" +
        "  | '.'\n" +
        "  ;\n",
        lg);
View Full Code Here

        "SLL_ATNTransitions=1, SLL_DFATransitions=0, LL_Fallback=0, LL_lookahead=0, LL_ATNTransitions=0}";
    assertEquals(expecting, info[0].toString());
  }

  @Test public void testLL2() throws Exception {
    Grammar g = new Grammar(
        "parser grammar T;\n" +
        "s : ID ';'{}\n" +
        "  | ID '.'\n" +
        "  ;\n",
        lg);
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.