answersLogoWhite

0

letter -> [a-zA-Z]

digit -> [0-9]

identifier -> letter|_(letter|digit|_)

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
RossRoss
Every question is just a happy little opportunity.
Chat with Ross

Add your answer:

Earn +20 pts
Q: How to design a DFA that accepts an identifier in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Distinguish between dfa and nfa?

DFA stands for Deterministic finite automaton and NFA stands for Nondeterministic finite automaton.Formally, an automaton is made up of: were delta is the transition function. In a DFA, delta takes as input a state and letter and returns only one state. In an NFA, delta takes as input a state and letter but returns a set of states.An NFA accepts a word iff there exists a run of the automaton on it (intuitively, the automaton guesses an accepting run). A DFA has only one run on every word and therefore accepts a word iff the single run on it is accepting.


Can DFA simulate NFA?

Yes, a Deterministic Finite Automaton (DFA) can simulate a Non-deterministic Finite Automaton (NFA). This can be achieved by constructing an equivalent DFA for a given NFA using the subset construction method. In this method, each state of the DFA represents a set of states of the NFA, and transitions are defined based on the transitions of the NFA. By following this approach, a DFA can effectively simulate the behavior of an NFA.


What is the difference between deterministic finite automata and non deterministic finite automata?

A deterministic Finite Automata)DFA will have a single possible output for a given input.The answer is deterministic because you can always feel what the output will be.A (Nondeterministic Finite Automata)NFA will have at least one input which will cause a "choice" to be made during a state transition,unlike a (deterministic Finite Automata)DFA one input can cause multiple outputs for a given (Nondeterministic Finite Automata)NFA.


Difference between deterministic finite automaton and non deterministic finite automaton?

The state machine described in the previous section is a deterministic finite automaton, in which each state is unique. What would make a finite automaton nondeterministic is if each state was not. For the example, if the state machine allowed the input to have any letter as the second letter for the word "person" to transition to the next, then the next state would not be unique, making it a nondeterministic finite automaton.


C program for implement DFA to all string of abb?

#include<stdio.h> #include<conio.h> void main() { int state[10]; int str[10],input[10]; char ch; int x[20]; int s,n,k=0,j,a,i,l,t,q=0,fs,b,nxt; clrscr(); printf("enter the no. states\n"); scanf("%d",&s); printf("enter the no.of i/ps\n"); scanf("%d",&n); for(i=0;i<s;i++) { printf("enter the state\n"); scanf("%d",&state[i]); printf("is it final state?... .y..1/n..0\n"); scanf("%d",&a); if(a==1) fs=state[i]; } printf("enter the i/ps\n"); for(i=0;i<n;i++) scanf("%d",&input[i]); printf("transition state\n"); for(i=0;i<s;i++) { for(j=0;j<n;j++) { printf("(q%d,%d)=q",state[i],input[j]); scanf("%d",&b); x[k]=b; k++; } } printf("enter the length of string\n"); scanf("%d",&l); printf("enter the i/p string\n"); for(i=0;i<l;i++) scanf("%d",&str[i]); for(i=0;i<l;i++) { t=0; do { if(str[i]==input[t]) { nxt=x[n*q+t]; for(j=0;j<s;j++) { if(nxt==state[j]) q=j; } t++; } else t++; } while(t!=n); } if(nxt==fs) printf("\n string is accepted\n"); else printf("\n not accepted\n"); getch(); }