Skip to content

Commit

Permalink
when i wiiiiiiiiiith youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
Browse files Browse the repository at this point in the history
  • Loading branch information
Encapsulateed committed Jan 24, 2024
1 parent 754231f commit 8392a40
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 377 deletions.
3 changes: 0 additions & 3 deletions lab5/input.txt

This file was deleted.

8 changes: 0 additions & 8 deletions lab5/result.txt

This file was deleted.

44 changes: 32 additions & 12 deletions lab5/src/lr0/LR0Fms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class LR0FMS extends FSM {

//addMove(state, transition_set[0].to, l);


if (X != 'eps') {
statyByLR0[newl.toString()] = transition_set[0].to;
}
Expand All @@ -176,6 +175,7 @@ class LR0FMS extends FSM {
}
}
} catch (e) {
print(e);
return;
// continue;
}
Expand All @@ -186,28 +186,48 @@ class LR0FMS extends FSM {
if (state == N0) {
return;
}
var trans = super
.transactions
.where((trans) => trans.from == state && trans.to == N0)
.toList()
.firstOrNull;

if (_grammar.nonTerminals.contains(X)) {
for (var l_0 in state.value as List<LR0Situation>) {
var copySt = [...state.value as List<LR0Situation>];

for (var l_0 in copySt) {
if (l_0.left == X) {
var prev_lr0 = LR0Situation(l_0.left, l_0.right, l_0.LR0_pointer - 1);
if (prev_lr0.LR0_pointer == -1) {
prev_lr0.LR0_pointer = 0;
}

var prev_copy = prev_lr0.clone();
prev_copy.move();


if ((N0.value as List<LR0Situation>).contains(prev_lr0) == false &&
(N0.value as List<LR0Situation>).contains(prev_copy) == false) {
(N0.value as List<LR0Situation>).add(prev_lr0.clone());
N0.name += '\n${prev_lr0.toString()}';
statyByLR0[prev_lr0.toString()] = N0;
prev_copy.move();

if ((N0.value as List<LR0Situation>).contains(prev_lr0) == false) {
{
if (trans == null) {
//print('Сейчас я добавлю LR0 ${prev_lr0} к ${getStateIndex(N0)} из ${getStateIndex(state)}');
(N0.value as List<LR0Situation>).add(prev_lr0.clone());
N0.name += '\n${prev_lr0.toString()}';
statyByLR0[prev_lr0.toString()] = N0;
} else {
if ((state.value as List<LR0Situation>).contains(prev_copy) ==
false) {

(N0.value as List<LR0Situation>).add(prev_lr0.clone());
// print('Сейчас я добавлю LR0 ${prev_lr0} к ${getStateIndex(N0)} из ${getStateIndex(state)}');

N0.name += '\n${prev_lr0.toString()}';
statyByLR0[prev_lr0.toString()] = N0;
}
}
}
}

if (_grammar.nonTerminals.contains(prev_lr0.getNext()) &&
X != prev_lr0.getNext() ) {
X != prev_lr0.getNext()) {
load_rules(state, N0, prev_lr0.getNext());
}
}
Expand Down
194 changes: 0 additions & 194 deletions lab5/t

This file was deleted.

Loading

0 comments on commit 8392a40

Please sign in to comment.