Add text-based parser for easier pushdown automaton creation#26
Draft
Add text-based parser for easier pushdown automaton creation#26
Conversation
Co-authored-by: aneshodza <75726773+aneshodza@users.noreply.github.com>
Co-authored-by: aneshodza <75726773+aneshodza@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Please make an easier way to use the library. something more "text-parsy" like giving the math noitation of the automaton and then we create the object structure etc. in the background\
Add text-based parser for easier pushdown automaton creation
Aug 14, 2025
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.
This PR implements a text-based parser that allows users to create pushdown automata using mathematical notation instead of manually constructing objects. This addresses the need for a more "text-parsy" approach to defining PDAs.
Problem
Previously, creating a pushdown automaton required verbose manual construction:
Solution
Now users can define PDAs using standard mathematical notation:
Features Added
δ(state, input, stack) = (next_state, stack_push)PushdownAutomaton.fromDefinition()andPushdownAutomaton.fromSimpleConfig()ε,epsilon, and empty string notations#are ignoredδanddeltafunction namesEnhanced Automaton Engine
The parser required improvements to the core automaton to properly handle epsilon transitions:
Examples
Balanced Parentheses:
Context-Free Language a^n b^n:
Testing
This enhancement makes the library significantly more accessible while maintaining the full power and flexibility of the underlying automaton engine.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.