Skip to content

Commit

Permalink
Убрал -1е состояние
Browse files Browse the repository at this point in the history
  • Loading branch information
Encapsulateed committed Feb 7, 2024
1 parent cc19d2d commit 522826f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions lab5/input.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
S -> aQ&Rb
S -> a
S -> b
Q -> Sb
R -> aS
S->SSS
S->SS
S->bbS
S->bb
5 changes: 2 additions & 3 deletions lab5/src/lr0/LR0Fms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ class LR0FMS extends FSM {
super.states.add(first);
super.startStates.add(first);

super.transactions.add(
Transaction.ivan(getStateByIndex(0), first, _grammar.startNonTerminal));
load_rules(first, _grammar.startNonTerminal);
}

void buildDFA() {
// Начальное состояние соответвует G+ - пополненной грамматике
create_super_zero_state();

create_first_state();

while (true) {
Expand All @@ -73,7 +72,7 @@ class LR0FMS extends FSM {
try {
shift(getStateByIndex(i));
} catch (e) {
print(e);
// print(e);
}
}
int n_l = super.states.length;
Expand Down
3 changes: 2 additions & 1 deletion lab5/src/state_machine/FSM.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class FSM {
void DumpToDOT(String path) {
String res = "";

for (var state in this.states) {
for (var state
in this.states.where((element) => getStateIndex(element) != -1)) {
String shape = "circle";
if (finalStates.contains(state)) {
shape = "doublecircle";
Expand Down

0 comments on commit 522826f

Please sign in to comment.