question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement NFA features (e.g. input reading) for GNFA

See original GitHub issue

@abhinavsinha-adrino I’m starting to wonder if I misunderstood the purpose of GNFAs when I suggested that we subclass GNFA from NFA. Let me explain the context:

I was trying to write a test for GNFA just now to verify that GNFA.read_input_stepwise() operates as expected. However, I was encountering one error after another in trying to accomplish this. I then realized that, because GNFAs can have non-state values (i.e. regex strings and None) in the transition map, maybe it doesn’t make sense to use methods like read_input_stepwise on a GNFA.

This then made me wonder if it was a mistake to subclass GNFA from NFA, since it seems like there could be a whole bunch of methods (like read_input_stepwise) that either would fail or just wouldn’t make sense to have available on GNFA.

What do you think? Given what you know about Automata theory and the purpose of GNFAs, would it make sense to have functional methods like GNFA.read_input_stepwise? Would it make more sense semantically to subclass GNFA from FA instead of NFA?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
abhinavsinha-adrinocommented, Sep 26, 2022

@caleb531 It’s absolutely the fact that GNFAs are only used for conversion to regex so yes I’m of the same opinion that we do not implement input reading methods.

And again, there is no other feasible way to implement such method without using NFA. Let me explain, we cannot jump from one state to another in a GNFA from one input, because the transition takes a regex and each regex corresponds a whole set of states (basically NFA). Either as a whole or piece wise, we cannot implement input reading methods without NFAs.

I very much support your proposal, this keeps things simple but yet complete.

1reaction
caleb531commented, Sep 7, 2022

@abhinavsinha-adrino That’s fine! School should be a priority.

I’ll see if I can take a stab at it, and perhaps submit you a PR for you to review.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Office Hours #7 with Easy Theory - NFA to DFA, GNFA ...
For example, you will see that there is no software that can check whether a C program will halt on a particular input....
Read more >
q1 q2 q3 a b b a a, b - NJIT
It is presented an input string w over an alphabet Σ; i.e., w ∈ Σ∗ . It reads in the ... Use generalized...
Read more >
Nondeterministic Finite Automata
1.1 Example: Taking the union of two languages. 2 Every NFA can be reduced to a DFA. 3 Closing Thoughts: Nondeterminism and Programming....
Read more >
Automata Theory - Juan Cruz Viotti
A GNFA is a NFA where the transitions can be regular expressions instead of just words from an alphabet, or . Therefore, a...
Read more >
Converting an NFA to regex using GNFA algorithm?
So I've been trying to crack this for a long time and almost feel like I am going in loops about this question....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found