Questions tagged [finite-automata]

A finite automaton (FA) is a mathematical description of an algorithm capable of parsing regular languages. FAs have no external memory, and as such can only take into account a fixed number of previous symbols when processing strings. A deterministic FA (DFAs) is one for which there is only ever one legal transition between states; nondeterministic FAs can be transformed into equivalent DFAs. FAs are the weakest of the commonly-defined automata.

585 questions
4
votes
1 answer

Construct DFA for L = {(na(w)-nb(w)) mod 3>0}

As per the title: L = {(na(w)-nb(w)) mod 3>0} Alphabet = {a,b} I found two answers to this problem: In this solution, our language is accepted. However, w = b is accepted as well. In the next solution: Our problem of w = b is solved here but w…
Shubham
  • 153
  • 1
  • 2
  • 9
4
votes
2 answers

How many languages does a DFA recognize?

According to Sipser's "Introduction to the Theory of Computation": If A is the set of all strings that machine M accepts, we say that A is the language of machine M and write L(M) = A. We say that M recognizes A ... A machine may accept several…
4
votes
2 answers

NFA recognizer in LISP

I have to define a function in lisp that, given a regular expression and an e-NFA as input, it returns true if the expression is accepted by the automata. For start, I've defined a function that generates an e-NFA (as a cons-cell) from a regular…
Fred_2
  • 249
  • 2
  • 11
4
votes
1 answer

Designing a DFA (alphabet 'a' and 'b') : The number of 'a' in the string must be a multiple of 3, and the string does not contain 'aba'

Here is the problem: And here is my line of reasoning when I first came upon it: This one seems difficult Finding a regular expression for it seems tricky, so i cannot follow this path to convert the regular expression to a DFA So I decided to…
4
votes
3 answers

Regular Expression to DFA

Can someone tell me if the attached DFA is correct ? I am suppose to give DFA for the language that has alphabet Σ ={a, b} I need DFA for this ----> A={ε, b, ab}
Jon Abraham
  • 851
  • 3
  • 14
  • 27
4
votes
2 answers

How to find useless states in a finite state machine Prolog

I have been thinking of a solution for finding all the useless states defined in a particular automaton and I know that one approach is to start moving from the start state and then ask for the following state all of these stored in the Prolog…
ditmark12
  • 111
  • 1
  • 11
4
votes
3 answers

Theory of Computation - Showing that a language is regular

I'm reviewing some notes for my course on Theory of Computation and I'm a little bit stuck on showing the following statement and I was hoping somebody could help me out with an explanation :) Let A be a regular language. The language B = {ab | a…
Tony
  • 107
  • 2
  • 6
4
votes
5 answers

Why does my finite state machine take so long to execute?

I'm working on a state machine which is supposed to extract function calls of the form /* I am a comment */ //I am a comment pref("this.is.a.string.which\"can have QUOTES\"", 123456); where the extracted data would be…
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
4
votes
1 answer

how can I simplify a regular expression generated from a DFA

I try to implement the Brzozowski algebraic method using Java, to generate the regular expression of the langage accepted by a given DFA, The expression generated is correct but not simplified. For example…
Elh.yas
  • 41
  • 3
4
votes
2 answers

Efficient way to store list of URLs

I need to store trillion of list of URLs where each URL list will contain ~50 URLs. What would be the most space efficient way to compress them for on-disk storage. I was thinking of first removing useless information like "http://" and then build a…
skyde
  • 2,816
  • 4
  • 34
  • 53
4
votes
3 answers

concatenation & union - regular and context free languages

Given L1 context free non regular language. Given L2 regular language. Is it possible that L1 U L2 = regular language ? Also, is it possible that L1*L2 = regular language ? I think that the 2nd one is impossible. But I'm not sure. Would love to see…
Rouki
  • 2,239
  • 1
  • 24
  • 41
4
votes
2 answers

Coding a propositional logic parser by hand

I need to do a parser for propositional logic. I pretend to do it by hand implemented like a recursive descent parser in java. My question is about the lexer, is it really needed for this job? I mean to define a finite state machine to recognize…
Wyvern666
  • 633
  • 1
  • 11
  • 26
4
votes
1 answer

regex for all legit regex's

I am curious if there is such a regular expression which defines all possible regular expressions. Since there are escape characters that might appear in an RE, it would be tricky to denote such characters in another, say validator, RE since RE's…
bfaskiplar
  • 865
  • 1
  • 7
  • 23
4
votes
5 answers

Finite State Machine in Objective-C

Does anyone have a solution for a basic, compact Finite state machine/automata written in Objective-C code? I am interested in reusable components so that the FSM have states added and actions defined that use reusable state classes.
Brock Woolf
  • 46,656
  • 50
  • 121
  • 144
3
votes
2 answers

ANTLR check if commontree is correct or How to check if given input matches the ANTLR grammar?

Hi I want to do a java or c# method which will return a boolean expression true or false based on the given input. For example: if (input matches the antlr grammar) return true; else return false; So the problem is i dont know how to…