Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the architecture #27

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

bygu4
Copy link

@bygu4 bygu4 commented Nov 28, 2024

Here we plan to rework the architecture of Pyformlang library, removing cyclic imports and hopefully making the design clearer. That would further allow us to add type annotations for most of the code, improving its rigor and readability as well as the interface of the project. For more detail, see issues:

bygu4 and others added 30 commits September 28, 2024 21:02
…tring_generator

String generator for finite automata
…string_generator

Correct string generator for finite automata
@bygu4
Copy link
Author

bygu4 commented Nov 28, 2024

Rework several modules and their relations with adding type annotations. The following modules were affected:

  • finite_automaton,
  • regular_expression,
  • rsa,
  • cfg,
  • pda.

In more detail, we can describe the changes as follows.

finite_automaton:

  • Refactor automata transformations, including to_deterministic and remove_epsilon_transitions methods.
  • Move from_networkx to EpsilonNFA.
  • Rework transition functions of automata, adding DeterministicTransitionFunction class and TransitionFunction abstract class.
  • Refactor automata copying, add missing copy method for NFA.
  • Make FiniteAutomaton an abstract class.
  • Remove Regexable interface, implement automata union, concatenation and kleene star manually.
  • Add more methods for finite automata, including get_transitions_from, get_next_states_from, etc.
  • Add utils file for containing finite automata utility.

regular_expression:

  • Refactor automata to regex transformations, build regex from automata in Regex class.
  • Add copying of ENFA in to_epsilon_nfa method.
  • Add to_minimal_dfa method to Regex for using in recursive automata.
  • Remove from_python_regex method.

rsa:

  • Correct some properties and type annotations.

cfg and pda:

  • Define intersection with DFA explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant