Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
cdcda863
Commit
cdcda863
authored
Mar 13, 2020
by
Kateřina Sloupová
Browse files
more fixes in DFA minimization and emptiness check
parent
3710e7f4
Pipeline
#55279
failed with stage
in 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fja_checker.py
View file @
cdcda863
from
parser
import
Parser
,
ParsingError
from
reg_automata
import
DFA
from
reg_automata
import
DFA
,
State
from
antlr4
import
RecognitionException
# type: ignore
import
sys
import
signal
...
...
@@ -17,7 +17,9 @@ def parse(string: str, automaton_type: str) -> DFA:
return
automaton
except
ParsingError
as
message
:
print
(
message
)
print
(
"Parsing error:"
,
message
)
except
AttributeError
as
message
:
print
(
"Parsing error:"
,
message
)
...
...
reg_automata.py
View file @
cdcda863
...
...
@@ -409,9 +409,13 @@ class DFA:
if
len
(
reachable
.
intersection
(
self
.
final
))
==
0
:
return
IsEmptyResult
()
word
=
[]
state
=
reachable
.
intersection
(
self
.
final
).
pop
()
if
state
==
self
.
init
:
return
IsEmptyResult
(
'ε'
)
# TODO some Eps -> str
else
:
word
=
[]
state
=
reachable
.
intersection
(
self
.
final
).
pop
()
while
state
is
not
self
.
init
:
word
.
append
(
predecessor
[
state
][
1
].
name
)
state
=
predecessor
[
state
][
0
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment