• 大小: 50KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-09-01
  • 语言: C#
  • 标签: C#  VS2005  

资源简介

LL1 语法分析器、控制台、C#、VS2005

资源截图

代码片段和文件信息

using System;
using System.Text;
public class Arithmetic{

private string vnSign = null;

    private string vtSign = null;

    private StringBuilder strTransport = null;

    private char nullSign = ‘\0‘;

    const char dollarSign  = ‘$‘;

    const char pound = ‘#‘;


    private string[] first1Collection = null;

    private string[] first2Collection = null;

    private string[] followCollection = null;

private string[] selectCollection = null;

    private string[] tableOfNullSign = null;

    private string[] anaylsisTable = null;

private Grammar grammar = null;

public string VnSign{
get{
return this.vnSign;
}
}

public string VtSign{
get{
return this.vtSign;
}
}

public char NullSign{
get{
return this.nullSign;
}
}

public string[] First1Collection{
get{
return this.first1Collection;
}
}

public string[] First2Collection{
get{
return this.first2Collection;
}
}

public string[] FollowCollection{
get{
return this.followCollection;
}
}

public string[] SelectCollection{
get{
return this.selectCollection;
}
}

    public string[] TableOfNullSign{
        get{
            return tableOfNullSign;
        }
    }

    public string[] AnaylsisTable
    {
        get{
            return anaylsisTable;
        }
    }

  
public Grammar Grammar{
get{
return this.grammar;
}
       
}

    public void SetGrammar(Grammar grammar){
        this.grammar = grammar;
    }

public void ComputeSignCollection(){
        for (int i = 0; i < grammar.Amount; i++)
        {
            for (int j = 0; j < grammar[i].Length; j++)
            {
               if (System.Char.IsUpper(grammar[i][j]))
               {
                   SetCollectionValue(ref vnSign grammar[i][j]);
               }
               else if (grammar[i][j] == dollarSign)
               {
                   if (nullSign == ‘\0‘)
                       nullSign = grammar[i][j];
               }
               else
               {
                   if (grammar[i][j] == dollarSign || grammar[i][j] == pound)
                   {
                       break;
                   }
                   else if (grammar[i][j] == ‘-‘ && grammar[i][j + 1] == ‘>‘)
                   {
                       j += 1;
                       continue;
                   }
                   else
                   {
                       SetCollectionValue(ref vtSign grammar[i][j]);
                   }

               }
            }
        } 
      SortCollection(vnSign.Substring(1 vnSign.Length - 1));
      vnSign = vnSign.Remove(1);
      vnSign += strTransport.ToString();
      SortCollection(vtSign);
      vtSign = strTransport.ToString();
}

    private void SortCollection(string str){

        int i = 0 j = 1;

        char ch = ‘\0‘;

        bo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2058  2008-05-30 04:04  ConsleLL1\ConsleLL1\obj\ConsleLL1.csproj.FileListAbsolute.txt

     文件      32768  2008-05-30 04:04  ConsleLL1\ConsleLL1\bin\Debug\ConsleLL1.exe

     文件      32768  2008-05-29 12:13  ConsleLL1\ConsleLL1\bin\Release\ConsleLL1.exe

     文件      32768  2008-05-30 04:04  ConsleLL1\ConsleLL1\obj\Debug\ConsleLL1.exe

     文件      32768  2008-05-29 12:13  ConsleLL1\ConsleLL1\obj\Release\ConsleLL1.exe

     文件       5632  2005-12-08 14:51  ConsleLL1\ConsleLL1\bin\Debug\ConsleLL1.vshost.exe

     文件       5632  2005-12-08 14:51  ConsleLL1\ConsleLL1\bin\Release\ConsleLL1.vshost.exe

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\bin\Debug

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\bin

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\obj\Debug\TempPE

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\obj\Debug

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\Properties

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\bin\Release

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\obj\Release\TempPE

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\obj\Release

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1\obj

     文件      30015  2008-05-30 02:38  ConsleLL1\ConsleLL1\Arithmetic.cs

     文件       1189  2008-05-24 02:46  ConsleLL1\ConsleLL1\Properties\AssemblyInfo.cs

     文件       3893  2008-05-26 07:07  ConsleLL1\ConsleLL1\Grammar.cs

     文件       9652  2008-05-30 04:04  ConsleLL1\ConsleLL1\Program.cs

     文件       2031  2008-05-24 06:43  ConsleLL1\ConsleLL1\ConsleLL1.csproj

     文件      46592  2008-05-29 12:13  ConsleLL1\ConsleLL1\bin\Release\ConsleLL1.pdb

     文件      46592  2008-05-29 12:13  ConsleLL1\ConsleLL1\obj\Release\ConsleLL1.pdb

     文件      56832  2008-05-30 04:04  ConsleLL1\ConsleLL1\bin\Debug\ConsleLL1.pdb

     文件      56832  2008-05-30 04:04  ConsleLL1\ConsleLL1\obj\Debug\ConsleLL1.pdb

     目录          0  2008-05-30 07:37  ConsleLL1\ConsleLL1

     文件        916  2008-05-25 20:55  ConsleLL1\ConsleLL1.sln

    ..A..H.     37376  2008-05-30 04:14  ConsleLL1\ConsleLL1.suo

     目录          0  2008-05-30 07:37  ConsleLL1

----------- ---------  ---------- -----  ----

............此处省略2个文件信息

评论

共有 条评论