A.
, .
1 (1-3 .)
L, .
1. (. 1.1., 1.2., 1.3.). , . .
2. L . , 1.3. 1.
1. .
2. .
3. ( 1).
4. .
5. , # ( 2.).
5.1. :
5.2. ,
.
.
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
namespace ConsoleApplication {
class Program {
static void Main(string[] args) {
ArrayList Q = new ArrayList();
string str;
Console.WriteLine("Hello");
str = Console.ReadLine();
Console.WriteLine("is= "+str);
Console.ReadLine();
}
}
}
#:
class Automate { // NDKA (Q,Sigma,deltaList,q0,F)
ArrayList Q = null; // c
ArrayList Sigma = null; //
ArrayList DeltaList = new ArrayList(); // c
string Q0 = null; //
ArrayList F = null; //
// C#
public ArrayList q { get { return Q; } set { Q = value; } }
public ArrayList sigma { get { return Sigma; } set { Sigma = value; } }
public ArrayList deltaList { get { return DeltaList; }
set {DeltaList = value; } }
public string q0 { get { return Q0; } set { Q0 = value; } }
public ArrayList f { get { return F; } set { F = value; } }
public Automate() {
this.Q = new ArrayList();
this.Sigma = new ArrayList();
this.DeltaList = new ArrayList();
this.F = new ArrayList();
}
public Automate(string aname) {
System.Console.WriteLine(aname);
// , NDKA
// . Test
//init();
Test();
}
:
class Delta { // Delta
private string LeftNoTerm = null;
private string LeftTerm = null;
private ArrayList Right = null;
public string leftNoTerm { get { return LeftNoTerm; } set { LeftNoTerm = value; } }
public string leftTerm { get { return LeftTerm; } set { LeftTerm = value; } }
|
|
public ArrayList right { get { return Right; } set { Right = value; } }
//
// delta(A, 1) = {qf}
// LeftNoTerm LeftTerm Right
public Delta(string LeftNoTerm, string LeftTerm, ArrayList Right) {
this.LeftNoTerm = LeftNoTerm;
this.LeftTerm = LeftTerm;
this.Right = Right;
}
public void DebugDeltaRight() {
int i = 0;
for (; i < this.right.Count; i++) {
if (i == 0)
System.Console.Write(" (" + this.right[i]);
else
System.Console.Write("," + this.right[i]);
}
if (i == 0)
System.Console.WriteLine();
else
System.Console.WriteLine(") ");
}
} // end class Delta
public void Test(){ //
Q = new ArrayList() { "S0", "A", "B", "qf" }; // "C"
Sigma = new ArrayList() { "0", "1"};
q0 = "S0";
F = new ArrayList() { "qf" };
Delta delta = null;
// 1. transition
delta = new Delta("S0", "0", new ArrayList() {"A","qf"});
DeltaList.Add(delta);
// 2. transition
delta = new Delta("A", "1", new ArrayList() { "B"});
DeltaList.Add(delta);
// 3. transition
delta = new Delta("B", "0", new ArrayList() { "A","qf"});
DeltaList.Add(delta);
} // end test
:
foreach (Delta d in this.DeltaList) {
if (d.leftNoTerm == q && d.leftTerm == chain.Substring(i,1)) {
}
}
6. . ( 3.).
7. .
2 (4-6 .)
- G = (T, V, P, S) .
1. - . (. 1.4.). , - . . 4 ,. . 5 ,., . 6 F,E.
2. -..
A). G . 1.4.3. G.
B). G ε, 1.4.5.
C). K G , 1.4.6.
D). - G1, . 1.4.7. G.
F). (, ) - G.
E). G -.
3. .
3 (7-8 .)
- P - - G = (T, V, P, S), . . . . 7. -2.1. . 8. -2.2.
1. - P - - (. 1.4.). , - P -.
2. . 1.4. 4.
2.1. A). - - G, 1.4.8.
B). - .
|
|
2.2. A). -, 1.4.9.
B). - P.
3. -.
4. .
4 (9-10 .)
- (. 1.3.). , , .
1. (. 1.1.). , -. - .
2. - . 1.3. , : . . 9 1-4. . 10 5-7.
1. - .
2. .
3. .
4. .
5. {} .
6. .
7. .
3. .
5 (11-10 .)
- , 5 , - . - (. 1.4.).
1. (. 1.1.). , , . , . ?
2. - - .
1. (. 1.3.).
2. .
3. .
4. .
5. .
6. .