Skip to content

Commit

Permalink
Fix grammars in tasks 7-9
Browse files Browse the repository at this point in the history
Fix typo in G3 and allow epsilon in G4
  • Loading branch information
WoWaster committed May 8, 2024
1 parent 44d41e6 commit e888981
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/autotests/test_task7.py
Expand Up @@ -90,7 +90,7 @@
"S -> S1 | S2\nS1 -> Sab | S1 c\nSab -> $ | a Sab b\nS2 -> Sbc | a S2\nSbc -> b Sbc c"
),
cfg.CFG.from_text("S -> a | b | S c S | S d S | e S f | g S"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | f S c | f S e"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | d S c | f S e"),
]

LABELS = ["a", "b", "c", "d", "e", "f", "g", "h"]
Expand Down
4 changes: 2 additions & 2 deletions tests/autotests/test_task8.py
Expand Up @@ -91,11 +91,11 @@
"S -> S1 | S2\nS1 -> Sab | S1 c\nSab -> $ | a Sab b\nS2 -> Sbc | a S2\nSbc -> b Sbc c"
),
cfg.CFG.from_text("S -> a | b | S c S | S d S | e S f | g S"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | f S c | f S e"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | d S c | f S e"),
]

EBNF_GRAMMARS = [
"""S -> ( Sab c* ) | ( a* Sbc )
"""S -> ( Sab c* ) | ( a* Sbc ) | $
Sab -> a ( Sab | $ ) b
Sbc -> b ( Sbc | $ ) c""",
"S -> a | b | (S ( c | d ) S ) | ( e S f ) | ( g S )",
Expand Down
4 changes: 2 additions & 2 deletions tests/autotests/test_task9.py
Expand Up @@ -92,11 +92,11 @@
"S -> S1 | S2\nS1 -> Sab | S1 c\nSab -> $ | a Sab b\nS2 -> Sbc | a S2\nSbc -> b Sbc c"
),
cfg.CFG.from_text("S -> a | b | S c S | S d S | e S f | g S"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | f S c | f S e"),
cfg.CFG.from_text("S -> $ | a S b | b S a | e S f | S S | c S d | d S c | f S e"),
]

EBNF_GRAMMARS = [
"""S -> ( Sab c* ) | ( a* Sbc )
"""S -> ( Sab c* ) | ( a* Sbc ) | $
Sab -> a ( Sab | $ ) b
Sbc -> b ( Sbc | $ ) c""",
"S -> a | b | (S ( c | d ) S ) | ( e S f ) | ( g S )",
Expand Down

0 comments on commit e888981

Please sign in to comment.