資源簡介
右線性文法生成的語言是右線性語言,有限自動機識別和接受的語言是正則語言。而正則文法是左線性文法和右線性文法的統稱,所以右線性語言類與正則語言類是同一語言類。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Collections;
/****************************************************************************
?*?
?*?
?*?程序功能:右線性文法轉換為FA
?*?
?*?版本:V?1.0
?*?作者:朱雯
?*?學號:2009206350011
?*?學習單位:WHU.SKLSE
?*?
?*?
?*?**************************************************************************/
namespace?RLg_FA
{
????class?FA
????{
????????private?ArrayList?internal_state=new?ArrayList?();//內部狀態有限集合
????????private?ArrayList?input_alphabet=new?ArrayList?();//輸入字母表
????????private?SortedList?transfer_function?=?new?SortedList();//轉移函數
????????private?string?initial_state;//初始態
????????private?string?final_state;//終態
????????public?void?setInternalState(ArrayList?s)//內部狀態有限集合賦值
????????{
????????????this.internal_state?=?s;?
????????}
????????public?ArrayList?getInternalState()//得到內部狀態有限集合
????????{
????????????return?this.internal_state;
????????}
????????public?void?addInternalState(string?s)//添加內部狀態
????????{
????????????this.internal_state.Add(s);
????????}
????????public?void?setInputAlphabet(ArrayList?s)//輸入字母表賦值
????????{
????????????this.input_alphabet?=?s;
????????}
????????public?ArrayList?getInputAlphabet()//得到輸入字母表
????????{
????????????return?this.input_alphabet;
????????}
????????public?void?addInputAlphabet(string?s)//向字母表中添加終結符
????????{
????????????this.input_alphabet.Add(s);
????????}
????????public?void?setTransferFunction(SortedList?s)//轉移函數賦值
????????{
????????????this.transfer_function?=?s;
????????}
????????public?SortedList?getTransferFunction()//得到轉移函數
????????{
????????????return?this.transfer_function;
????????}
????????/**
?????????*?增加轉移函數?&(leftkeyrightkey)={value}
?????????*?如果轉移函數的左部key已存在,則在值列表中加入值?key=leftkeyrightkey
?????????*?否則值列表中只包含value
?????????*?*/
????????public?void?addTransferFunction(string?leftkeystring?rightkeystring?value)
????????{
????????????string?key=leftkey+““+rightkey;
????????????if?(!this.transfer_function.Contains(key))
????????????????this.transfer_function.Add(key?value);
????????????????//this.transfer_function.Add(key?new?ArrayList().Add(value));
????????????else
????????????{
????????????????int?index?=?this.transfer_function.IndexOfKey(key);
????????????????string?v?=?(string)this.transfer_function.GetByIndex(index);
????????????????if(!containsValue(valuev))
????????????????????transfer_function.SetByIndex(index?v?+?““?+?value);
????????????}
????????}
????????//判斷是否包含同一條轉移函數
????????public?bool?containsValue(string?valuestring?s)
????????{
????????????string[]?valueList?=?s.Split(‘‘);
????????????foreach?(string?str?in?valueList)
????????????{
????????????????if?(str.Equals(value))?return?true;
????????????}
????????????return?false;
?
????????}
????????public?void?setInitialState(string?s)//初始態賦值
????????{
????????????this.initial_state?=?s;
????????}
????????public?string?getInitialState()//得到初始態
????????{
????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\.vs\
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\.vs\RLg_FA\
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\.vs\RLg_FA\v15\
?????文件???????61440??2018-06-26?21:53??右線性文法構造有窮自動機\.vs\RLg_FA\v15\.suo
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\.vs\RLg_FA\v15\Server\
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\.vs\RLg_FA\v15\Server\sqlite3\
?????文件???????????0??2018-05-10?08:25??右線性文法構造有窮自動機\.vs\RLg_FA\v15\Server\sqlite3\db.lock
?????文件??????503808??2018-06-23?17:16??右線性文法構造有窮自動機\.vs\RLg_FA\v15\Server\sqlite3\storage.ide
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\Backup\
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\Backup\RLg_FA\
?????文件????????3453??2010-01-06?14:09??右線性文法構造有窮自動機\Backup\RLg_FA\FA.cs
?????文件???????16316??2010-01-06?13:07??右線性文法構造有窮自動機\Backup\RLg_FA\Form1.Designer.cs
?????文件????????8909??2010-01-07?20:48??右線性文法構造有窮自動機\Backup\RLg_FA\Form1.cs
?????文件????????6221??2010-01-06?13:07??右線性文法構造有窮自動機\Backup\RLg_FA\Form1.resx
?????文件?????????465??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Program.cs
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\
?????文件????????1160??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\AssemblyInfo.cs
?????文件????????2866??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\Resources.Designer.cs
?????文件????????5612??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\Resources.resx
?????文件????????1089??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\Settings.Designer.cs
?????文件?????????249??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA\Properties\Settings.settings
?????文件????????2139??2010-01-06?16:41??右線性文法構造有窮自動機\Backup\RLg_FA\RLg.cs
?????文件????????3323??2010-01-04?19:00??右線性文法構造有窮自動機\Backup\RLg_FA\RLg_FA.csproj
?????文件???????12215??2010-01-07?20:48??右線性文法構造有窮自動機\Backup\RLg_FA\parser.cs
?????文件?????????907??2010-01-02?20:20??右線性文法構造有窮自動機\Backup\RLg_FA.sln
?????目錄???????????0??2019-05-27?20:13??右線性文法構造有窮自動機\RLg_FA\
?????文件????????3383??2018-05-10?10:12??右線性文法構造有窮自動機\RLg_FA\FA.cs
?????文件???????18943??2018-05-11?10:24??右線性文法構造有窮自動機\RLg_FA\Form1.Designer.cs
?????文件????????8931??2018-05-11?12:01??右線性文法構造有窮自動機\RLg_FA\Form1.cs
?????文件????????6221??2018-05-11?10:24??右線性文法構造有窮自動機\RLg_FA\Form1.resx
............此處省略56個文件信息
- 上一篇:FPGA 自適應濾波器
- 下一篇:zw_深圳shp.zip
評論
共有 條評論