Conversation
# Conflicts: # src/main/kotlin/org/srcgll/grammar/combinator/Grammar.kt # src/main/kotlin/org/srcgll/rsm/RSMState.kt # src/main/kotlin/org/srcgll/rsm/symbol/Nonterminal.kt # src/main/kotlin/org/srcgll/rsm/symbol/Terminal.kt # src/test/kotlin/TestRSMStringInputWIthSPPFRecovery.kt # src/test/kotlin/TestRSMStringInputWithSPPFFail.kt # src/test/kotlin/TestRSMStringInputWithSPPFSuccess.kt # src/test/kotlin/rsm/api/TerminalsEqualsTest.kt # src/test/kotlin/rsm/builder/AStarTest.kt
| /** | ||
| * Only linear input | ||
| */ | ||
| fun constructIncremental(delta: RSMState, isRemoving: Boolean) { |
There was a problem hiding this comment.
А почему бы не выставить две функции в духе "добавить" и "удалить", а не флаг, который сложно трактовать, если не понимать, о чём речь?
There was a problem hiding this comment.
У RSMState есть методы "добавить" и "удалить".
Обертка над этим методом с нужными флагами. Перенесла их в файл RSMState.
| } | ||
| } | ||
| if (updatedStart == null) { | ||
| throw Exception("Start state should be updated!!") |
| } | ||
|
|
||
| fun isFinal(): Boolean { | ||
| if (isRemoving && delta.isFinal) { |
There was a problem hiding this comment.
Почему не записать как одно логическое выражение?
There was a problem hiding this comment.
тогда будет
!(isRemoving && delta.isFinal) && (origin.isFinal || delta.isFinal)
что мне кажется гораздо менее читабельно
придется каждый раз разбираться в этом условии
| } | ||
|
|
||
| /** | ||
| * Grammar for language S = ( S ) | [[ S ]] |
There was a problem hiding this comment.
А можете ещё для полноценного Дика, который
S -> \eps | a S b S | c S d S
Или даже
S -> (a S b)*
There was a problem hiding this comment.
На первом работает, добавила тесты
Надоело строить RSM дельты руками, добавила класс который строит ее из регулярки и переданного нетерминала.
На второй входит в вечный цикл))
There was a problem hiding this comment.
А как в такой язык что-то линейное добавить? Вход (c S d)* с циклом.
Вот и циклится.
There was a problem hiding this comment.
Так. Тут же есть пустая цепочка из S. Так что должно терминироваться.
There was a problem hiding this comment.
Ща. Или вопрос в том, что в динамиве добавлять? Так что-нибуль типа S -> v, чтобы v в "скобочках" выводилось
453dd29 to
2b1e9ee
Compare
Incrementalalgorithm for dynamically editing RSM: enable to add and remove linear input from RSM.Algorithm
Tests
Incremental Construction and Maintenance of Minimal Finite-State Automata (Carrasco & Forcada, CL 2002)