Package org.allspice.parser

Examples of org.allspice.parser.Rule


   * @throws StrandedSymbol
   * @throws InvalidStartRule
   */
  private static DefaultTranslationMapper createMapper() throws StateConflict, InvalidStartRule, StrandedSymbol {
    DefaultTranslationMapper mapper = new DefaultTranslationMapper() ;
    mapper.addTranslation(new Rule("E'","E"),new OneTrans()) ;
    mapper.addTranslation(new Rule("E","E","+","F"),new OpTrans()) ;
    mapper.addTranslation(new Rule("E","F"),new OneTrans()) ;
    mapper.addTranslation(new Rule("F","F","*","T"),new OpTrans()) ;
    mapper.addTranslation(new Rule("F","T"),new OneTrans()) ;
    mapper.addTranslation(new Rule("T","id"),new OneTrans()) ;
    mapper.addTranslation(new Rule("T","(","E",")"),new Paren()) ;
    return mapper;
  }
View Full Code Here


   * @throws StrandedSymbol
   * @throws InvalidStartRule
   */
  private DefaultTranslationMapper createMapper() throws StateConflict, InvalidStartRule, StrandedSymbol {
    DefaultTranslationMapper mapper = new DefaultTranslationMapper() ;
    mapper.addTranslation(new Rule("E'","E"),new TopTrans()) ;
    mapper.addTranslation(new Rule("E","E","+","E"),new PlusTrans()) ;
    mapper.addTranslation(new Rule("E","T"),new TermTrans()) ;
    mapper.addTranslation(new Rule("T","id"),new IdTrans()) ;
    mapper.addTranslation(new Rule("T","(","E",")"),new ParenTrans()) ;
    ImmutableMap<String,AssocType> assoc = new Tree23Map<String,AssocType>() ;
    assoc = assoc.insert("+", AssocType.right) ;
    assoc = assoc.insert("*", AssocType.right) ;
    return mapper;
  }
View Full Code Here

   * @throws StrandedSymbol
   * @throws InvalidStartRule
   */
  private DefaultTranslationMapper createMapper() throws StateConflict, InvalidStartRule, StrandedSymbol {
    DefaultTranslationMapper mapper = new DefaultTranslationMapper() ;
    mapper.addTranslation(new Rule("E'","E"),new TopTrans()) ;
    mapper.addTranslation(new Rule("E","E","+","E"),new PlusTrans()) ;
    mapper.addTranslation(new Rule("E","T"),new TermTrans()) ;
    mapper.addTranslation(new Rule("T","id"),new IdTrans()) ;
    mapper.addTranslation(new Rule("T","(","E",")"),new ParenTrans()) ;
    return mapper;
  }
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test0() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
        new Rule("T'","T")),
        new Tree23Map<String,AssocType>(),
        new Tree23Map<String,Integer>(),
        new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test1() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","T1","T2")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test3() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","A","B"),
      new Rule("A"),
      new Rule("A","T1"),
      new Rule("B"),
      new Rule("B","T2")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test4() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","A","B"),
      new Rule("A"),
      new Rule("A","T1"),
      new Rule("B","T2")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test5() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","A","T2"),
      new Rule("A"),
      new Rule("A","A","A","T1")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test6() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","A"),
      new Rule("A"),
      new Rule("A","A","A","T1")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first("T'");
View Full Code Here

   * @throws InvalidStartRule
   *
   */
  public void test7() throws InvalidStartRule, StrandedSymbol {
    Grammar g = new Grammar("T'",Arrays.asList(
      new Rule("T'","T")),
      new Tree23Map<String,AssocType>(),
      new Tree23Map<String,Integer>(),
      new Tree23Map<Rule,Integer>()) ;
    FirstStrategy ff = new FirstImpl(g) ;
    Set<String> f = ff.first();
View Full Code Here

TOP

Related Classes of org.allspice.parser.Rule

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.