• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Coco.Symbol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中at.jku.ssw.Coco.Symbol的典型用法代码示例。如果您正苦于以下问题:C# Symbol类的具体用法?C# Symbol怎么用?C# Symbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Symbol类属于at.jku.ssw.Coco命名空间,在下文中一共展示了Symbol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindAS

        void FindAS(Node p, Symbol nonTerminal)
        {
            // find ANY sets
            Node a;
            while (p != null) {
            if (p.typ == Node.opt || p.typ == Node.iter) {
                FindAS(p.sub, nonTerminal);
                a = LeadingAny(p.sub);
                if (a != null) {
                    if (p.next == null)
                        Sets.Subtract(a.set, nonTerminal.follow);
                    else
                        Sets.Subtract(a.set, First(p.next));
                }
            } else if (p.typ == Node.alt) {
                BitArray s1 = new BitArray(terminals.Count);
                Node q = p;
                while (q != null) {
                    FindAS(q.sub, nonTerminal);
                    a = LeadingAny(q.sub);
                    if (a != null)
                        Sets.Subtract(a.set, First(q.down).Or(s1));
                    else
                        s1.Or(First(q.sub));
                    q = q.down;
                }
            }

            // Remove alternative terminals before ANY, in the following
            // examples a and b must be removed from the ANY set:
            // [a] ANY, or {a|b} ANY, or [a][b] ANY, or (a|) ANY, or
            // A = [a]. A ANY
            if (DelNode(p)) {
                a = LeadingAny(p.next);
                if (a != null) {
                    Node q = (p.typ == Node.nt) ? p.sym.graph : p.sub;
                    Sets.Subtract(a.set, First(q));
                }
            }

            if (p.up) break;
            p = p.next;
            }
        }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:44,代码来源:Tab.cs


示例2: AttrDecl

 void AttrDecl(Symbol sym)
 {
     if (la.kind == 29) {
     Get();
     sym.isAuto = true; sym.attrPos = new Position(t.pos, t.pos + 6, t.col, t.line);
     } else if (la.kind == 30) {
     Get();
     int beg = la.pos; int col = la.col;
     while (StartOf(11)) {
         if (StartOf(12)) {
             Get();
         } else {
             Get();
             SemErr("bad string in attributes");
         }
     }
     Expect(31);
     if (t.pos > beg)
      sym.attrPos = new Position(beg, t.pos, col, t.line);
     } else if (la.kind == 32) {
     Get();
     int beg = la.pos; int col = la.col;
     while (StartOf(13)) {
         if (StartOf(14)) {
             Get();
         } else {
             Get();
             SemErr("bad string in attributes");
         }
     }
     Expect(33);
     if (t.pos > beg)
      sym.attrPos = new Position(beg, t.pos, col, t.line);
     } else SynErr(55);
 }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:35,代码来源:Parser.cs


示例3: GenErrorMsg

 void GenErrorMsg(int errTyp, Symbol sym)
 {
     errorNr++;
     err.Write("\t\t\tcase " + errorNr + ": s = \"");
     switch (errTyp) {
     case tErr:
         if (sym.name[0] == '"') err.Write(tab.Escape(sym.name) + " expected");
         else err.Write(sym.name + " expected");
         break;
     case altErr: err.Write("invalid " + sym.name); break;
     case syncErr: err.Write("this symbol not expected in " + sym.name); break;
     }
     err.WriteLine("\"; break;");
 }
开发者ID:jlyonsmith,项目名称:CocoR,代码行数:14,代码来源:ParserGen.cs


示例4: ConvertToStates

 public void ConvertToStates(Node p, Symbol sym)
 {
     curSy = sym;
     if (Tab.DelGraph(p)) {
     parser.SemErr("token might be empty");
     return;
     }
     NumberNodes(p, firstState, true);
     FindTrans(p, true, new BitArray(tab.nodes.Count));
     if (p.typ == Node.iter) {
     Step(firstState, p, new BitArray(tab.nodes.Count));
     }
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:13,代码来源:DFA.cs


示例5: MatchLiteral

 // match string against current automaton; store it either as a fixedToken or as a litToken
 public void MatchLiteral(string s, Symbol sym)
 {
     s = tab.Unescape(s.Substring(1, s.Length-2));
     int i, len = s.Length;
     State state = firstState;
     Action a = null;
     for (i = 0; i < len; i++) { // try to match s against existing DFA
     a = FindAction(state, s[i]);
     if (a == null) break;
     state = a.target.state;
     }
     // if s was not totally consumed or leads to a non-final state => make new DFA from it
     if (i != len || state.endOf == null) {
     state = firstState; i = 0; a = null;
     dirtyDFA = true;
     }
     for (; i < len; i++) { // make new DFA for s[i..len-1], ML: i is either 0 or len
     State to = NewState();
     NewTransition(state, to, Node.chr, s[i], Node.normalTrans);
     state = to;
     }
     Symbol matchedSym = state.endOf;
     if (state.endOf == null) {
     state.endOf = sym;
     } else if (matchedSym.tokenKind == Symbol.fixedToken || (a != null && a.tc == Node.contextTrans)) {
     // s matched a token with a fixed definition or a token with an appendix that will be cut off
     parser.SemErr("tokens " + sym.name + " and " + matchedSym.name + " cannot be distinguished");
     } else { // matchedSym == classToken || classLitToken
     matchedSym.tokenKind = Symbol.classLitToken;
     sym.tokenKind = Symbol.litToken;
     }
 }
开发者ID:Xpitfire,项目名称:CrossCompile,代码行数:33,代码来源:DFA.cs


示例6: Expected0

	// does not look behind resolvers; only called during LL(1) test and in CheckRes
	public BitArray Expected0(Node p, Symbol curSy) {
		if (p.typ == Node.rslv) return new BitArray(terminals.Count);
		else return Expected(p, curSy);
	}
开发者ID:ggrov,项目名称:tacny,代码行数:5,代码来源:Tab.cs


示例7: CNode

		public CNode (Symbol l, Symbol r) {
			left = l; right = r;
		}
开发者ID:ggrov,项目名称:tacny,代码行数:3,代码来源:Tab.cs


示例8: AttrDecl

	void AttrDecl(
#line 293 "Coco.atg" //SOURCE beg=12799,len=10,col=10
										Symbol sym
#line default //END SOURCE
) {
		if (la.kind == 25) {
			Get();

#line 294 "Coco.atg" //SOURCE beg=12850,len=36,col=36
																																				int beg = la.pos; int col = la.col; 
#line default //END SOURCE
			while (StartOf(9)) {
				if (StartOf(10)) {
					Get();
				} else {
					Get();

#line 296 "Coco.atg" //SOURCE beg=12934,len=36,col=36
																																				SemErr("bad string in attributes"); 
#line default //END SOURCE
				}
			}
			Expect(26);

#line 298 "Coco.atg" //SOURCE beg=13014,len=142,col=36
																																				if (t.pos > beg)
                                     sym.attrPos = new Position(beg, t.pos - beg, col, GetVirtualFile(), GetVirtualLine()); 
#line default //END SOURCE
		} else if (la.kind == 27) {
			Get();

#line 300 "Coco.atg" //SOURCE beg=13195,len=36,col=36
																																				int beg = la.pos; int col = la.col; 
#line default //END SOURCE
			while (StartOf(11)) {
				if (StartOf(12)) {
					Get();
				} else {
					Get();

#line 302 "Coco.atg" //SOURCE beg=13279,len=36,col=36
																																				SemErr("bad string in attributes"); 
#line default //END SOURCE
				}
			}
			Expect(28);

#line 304 "Coco.atg" //SOURCE beg=13359,len=142,col=36
																																				if (t.pos > beg)
                                     sym.attrPos = new Position(beg, t.pos - beg, col, GetVirtualFile(), GetVirtualLine()); 
#line default //END SOURCE
		} else SynErr(48);
	}
开发者ID:SealedSun,项目名称:prx,代码行数:53,代码来源:Parser.cs


示例9: CheckLL1

	public void CheckLL1() {
		foreach (Symbol sym in nonterminals) {
			curSy = sym;
			CheckAlts(curSy.graph);
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:6,代码来源:Tab.cs


示例10: GenProductions

 void GenProductions()
 {
     foreach (Symbol sym in tab.nonterminals) {
     curSy = sym;
     gen.Write("\tvoid {0}(", sym.name);
     if (sym.isAuto)
         gen.Write("Role role");
     else
         CopySourcePart(sym.attrPos, 0);
     gen.WriteLine(") {");
     if (sym.isAuto)
         gen.WriteLine("\t\tvar result = new {0}(); NodeStart(result);", sym.name);
     CopySourcePart(sym.semPos, 2);
     GenCode(sym.graph, 2, new BitArray(tab.terminals.Count));
     if (sym.isAuto)
         gen.WriteLine("\t\tNodeEnd(result, role);");
     gen.WriteLine("\t}"); gen.WriteLine();
     }
 }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:19,代码来源:ParserGen.cs


示例11: AttrDecl

	void AttrDecl(Symbol sym) {
		if (la.kind == 24) {
			Get();
			int beg = la.pos; int col = la.col; 
			while (StartOf(9)) {
				if (StartOf(10)) {
					Get();
				} else {
					Get();
					SemErr("bad string in attributes"); 
				}
			}
			Expect(25);
			if (t.pos > beg)
			 sym.attrPos = new Position(beg, t.pos, col); 
		} else if (la.kind == 26) {
			Get();
			int beg = la.pos; int col = la.col; 
			while (StartOf(11)) {
				if (StartOf(12)) {
					Get();
				} else {
					Get();
					SemErr("bad string in attributes"); 
				}
			}
			Expect(27);
			if (t.pos > beg)
			 sym.attrPos = new Position(beg, t.pos, col); 
		} else SynErr(45);
	}
开发者ID:ggrov,项目名称:tacny,代码行数:31,代码来源:Parser.cs


示例12: ConvertToStates

	public void ConvertToStates(Node p, Symbol sym) {
		curGraph = p; curSy = sym;
		if (tab.DelGraph(curGraph)) parser.SemErr("token might be empty");
		NumberNodes(curGraph, firstState);
		FindTrans(curGraph, true, new BitArray(tab.nodes.Count));
	}
开发者ID:SealedSun,项目名称:prx,代码行数:6,代码来源:DFA.cs


示例13: Node

        public int val; //!< chr:  ordinal character value

        #endregion Fields

        #region Constructors

        public Node(int typ, Symbol sym, int line, int col)
        {
            this.typ = typ; this.sym = sym; this.line = line; this.col = col;
        }
开发者ID:dgrunwald,项目名称:coco-csharp,代码行数:10,代码来源:Tab.cs


示例14: CompFollowSets

	void CompFollowSets() {
		foreach (Symbol sym in nonterminals) {
			sym.follow = new BitArray(terminals.Count);
			sym.nts = new BitArray(nonterminals.Count);
		}
		gramSy.follow[eofSy.n] = true;
		visited = new BitArray(nodes.Count);
		foreach (Symbol sym in nonterminals) { // get direct successors of nonterminals
			curSy = sym;
			CompFollow(sym.graph);
		}
		foreach (Symbol sym in nonterminals) { // add indirect successors to followers
			visited = new BitArray(nonterminals.Count);
			curSy = sym;
			Complete(sym);
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:17,代码来源:Tab.cs


示例15: CheckResolvers

	public void CheckResolvers() {
		foreach (Symbol sym in nonterminals) {
			curSy = sym;
			CheckRes(curSy.graph, false);
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:6,代码来源:Tab.cs


示例16: Expected

	public BitArray Expected(Node p, Symbol curSy) {
		BitArray s = First(p);
		if (DelGraph(p)) s.Or(curSy.follow);
		return s;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:5,代码来源:Tab.cs


示例17: Node

	public State    state;	// DFA state corresponding to this node
													// (only used in DFA.ConvertToStates)

	public Node(int typ, Symbol sym, int line) {
		this.typ = typ; this.sym = sym; this.line = line;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:6,代码来源:Tab.cs


示例18: CompSyncSets

	void CompSyncSets() {
		allSyncSets = new BitArray(terminals.Count);
		allSyncSets[eofSy.n] = true;
		visited = new BitArray(nodes.Count);
		foreach (Symbol sym in nonterminals) {
			curSy = sym;
			CompSync(curSy.graph);
		}
	}
开发者ID:ggrov,项目名称:tacny,代码行数:9,代码来源:Tab.cs


示例19: LL1Error

	//--------------- check for LL(1) errors ----------------------
	
	void LL1Error(int cond, Symbol sym) {
		string s = "  LL1 warning in " + curSy.name + ": ";
		if (sym != null) s += sym.name + " is ";
		switch (cond) {
			case 1: s += "start of several alternatives"; break;
			case 2: s += "start & successor of deletable structure"; break;
			case 3: s += "an ANY node that matches no symbol"; break;
			case 4: s += "contents of [...] or {...} must not be deletable"; break;
		}
		errors.Warning(s);
	}
开发者ID:ggrov,项目名称:tacny,代码行数:13,代码来源:Tab.cs


示例20: NewSym

	public Symbol NewSym(int typ, string name, int line) {
		if (name.Length == 2 && name[0] == '"') {
			parser.SemErr("empty token not allowed"); name = "???";
		}
		Symbol sym = new Symbol(typ, name, line);
		switch (typ) {
			case Node.t:  sym.n = terminals.Count; terminals.Add(sym); break;
			case Node.pr: pragmas.Add(sym); break;
			case Node.nt: sym.n = nonterminals.Count; nonterminals.Add(sym); break;
		}
		return sym;
	}
开发者ID:ggrov,项目名称:tacny,代码行数:12,代码来源:Tab.cs



注:本文中的at.jku.ssw.Coco.Symbol类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# net.BaseSocket类代码示例发布时间:2022-05-26
下一篇:
C# Coco.State类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap