Open
Conversation
Collaborator
Author
|
Significant architecture changes are:
|
gsvgit
reviewed
Dec 9, 2024
| def is_parsable(self, word: Iterable[Hashable], left: bool = True) -> bool: | ||
| """ | ||
| Whether a word is parsable or not | ||
|
|
| productions: Iterable[FeatureProduction] = None): | ||
| variables: AbstractSet[Hashable] = None, | ||
| terminals: AbstractSet[Hashable] = None, | ||
| start_symbol: Hashable = None, |
Member
There was a problem hiding this comment.
What the problem to make start_symbol has type Variable? Current type looks not pretty specific.
| from ..formal_object import FormalObject | ||
|
|
||
|
|
||
| class Terminal(CFGObject): |
Member
There was a problem hiding this comment.
Can it be unified over all regexps, grammars, etc? Terminal is a common thing for all language-related formalisms.
|
|
||
| Parameters | ||
| ----------- | ||
| value : any |
Member
There was a problem hiding this comment.
Can variable be unified over all cfg-related formalisms?
|
|
||
| Parameters | ||
| ---------- | ||
| given : any |
gsvgit
reviewed
Feb 13, 2025
|
|
||
| Parameters | ||
| ----------- | ||
| value : any |
|
|
||
| Parameters | ||
| ----------- | ||
| value : any |
| """ A state in a finite automaton | ||
|
|
||
| Parameters | ||
| ---------- |
94af59a to
1d1e8f1
Compare
…ration, add missing pda methods
…import cycles, correct types in get_words
…ions, add base epsilon class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here we plan to rework
cfgand some related modules, removing cycles and adding type annotations. Modules we should consider are:cfg;pda;fcfg.Changes by module:
objects:State,Terminal, etc.) to a separate module to improve the structure of the project and handle some design issues.FormalObjectclass.StackSymbolfromSymbolandEpsilonfromStackSymbolto handle some type mismatches.cfg:to_pdamethod fromCFGclass, addfrom_cfgmethod for pda instead.FormalGrammarabstract class to handle import cycles in cfg module, generalize some methods and properties.add_productionmethod for grammars, add methods for changing start symbol of the grammar.pdamodule.fcfg:from_textmethod for FCFG using generics in theFormalGrammarclass.add_productionby converting the given rule toFeatureProductionclass, use that conversion in the constructor.pda:cfgmodule.utilsfile.