Found 1259 Articles for Computers

Explain removing unit productions in context free grammar

Bhanu Priya
Updated on 16-Jun-2021 12:56:04

15K+ Views

All grammars are not always optimized, which means the grammar may consist of some extra symbols (non-terminals) which increase the length of grammar.So, we have to reduce the grammar by removing the useless symbols.PropertiesThe properties to reduce grammar are explained below −Each non-terminal and terminal of G appears in the derivation of some word in L.There should not be any production as X->Y where X and Y are non-terminals.If epsilon is not in language L then there need not be in the production X-> ε.The diagram given herewith describe the properties to reduce grammar −The unit productions are the productions ... Read More

Explain the elimination of epsilon productions in CFG

Bhanu Priya
Updated on 16-Jun-2021 12:38:15

7K+ Views

All grammars are not always optimized, which means the grammar may consist of some extra symbols (non-terminals) which increase the length of grammar.So, we have to reduce the grammar by removing the useless symbols.PropertiesThe properties to reduce grammar are explained below −Each non-terminal and terminal of G appears in the derivation of some word in L.There should not be any production as X->Y where X and Y are non-terminals.If epsilon is not in language L then there need not be in the production X-> ε.The diagram given below depicts the use of reduce grammar−The productions of type S-> ε are ... Read More

What are the closure properties for context free language?

Bhanu Priya
Updated on 16-Jun-2021 13:16:00

4K+ Views

The closure properties for context free language (CFG) are as follows −Closed under Union Operationn order to show that context-free language is closed under union operation, consider two starting variables S1 and S2 for the two different languages L1 and L2.Grammar for union operation is as shown below −S ->S1|S2If both the languages belong to the context free language then union of both the languages should belong to context free language.By the above definition if a user generates S1 and S2 string or both then in that case union of both the language is generated.Hence, L1 U L2 ∈ CFLSo, ... Read More

What is a recursive and recursively enumerable language?

Bhanu Priya
Updated on 16-Jun-2021 12:35:43

24K+ Views

Let us understand the concept of recursive language before learning about the recursively enumerable language in the theory of computation (TOC).Recursive LanguageA language L is recursive (decidable) if L is the set of strings accepted by some Turing Machine (TM) that halts on every input.ExampleWhen a Turing machine reaches a final state, it halts. We can also say that a Turing machine M halts when M reaches a state q and a current symbol ‘a’ to be scanned so that δ(q, a) is undefined.There are TMs that never halt on some inputs in any one of these ways, So we ... Read More

What is Instantaneous Description and Turnstile Notation?

Bhanu Priya
Updated on 16-Jun-2021 12:42:06

914 Views

The instantaneous description (ID) of a push down automata (PDA) is represented by a triple (q, w, s)Where, q is the state.w is unconsumed input.s is the stack contents.ID is an informal notation of how a PDA compares an input string and makes a decision that string is accepted or rejected.Turnstile NotationIt is used for connecting pairs of ID's that represent one or more moves of a PDA.The process of transition is denoted by the turnstile symbol "⊢"⊢ it represents one move.⊢ sign describes a sequence of moves.Example(P, b, T) ⊢ (q, w, a)While taking a transition from P to ... Read More

What is Push down automata in TOC?

Bhanu Priya
Updated on 07-Oct-2023 01:55:41

28K+ Views

A push down automata (PDA) is a way to implement a context free grammar (CFG) in a similar way to design the deterministic finite automata (DFA) for a regular grammar. A DFA can remember a finite amount of information but a PDA can remember an infinite amount of information. Basically, a PDA is as follows − "Finite state machine+ a stack" PDA has three components, which are as follows − An input tape. A control unit. A stack with infinite size. A PDA may or may not read input symbols, but it ... Read More

Explain if the CFG is recognized by Non-deterministic push down automata

Bhanu Priya
Updated on 16-Jun-2021 12:43:59

444 Views

Context Free Grammars (CFG) are definitely recognized by Non-deterministic push down automata (NPDA), but Programming languages are translated to binary (Machine Code) via Deterministic PDA.This is because it has the following below mentioned impacts −If Programming languages were supposed to be translated via NPDA then for one given program instance we will have multiple versions of binary(Machine code) generated for the same program, which ideally shouldn't be the scenario.For a given program only 1 version of binary code should be generated and that should remain consistent across all OS Platforms.Outputs will vary significantly: If we have multiple object files, then ... Read More

Design an unambiguous CFG in CNF that generates E?

Bhanu Priya
Updated on 16-Jun-2021 12:47:00

179 Views

ProblemDefine the language, E={aibj|i not equal to j and i not equal to 2j} and design an unambiguous context free grammar (CFG) in Chomsky normal form (CNF) that generates E.SolutionThe unambiguous CFG for the given language is as follows −S->AC|CBA->aA|aB->Bb|bC->aCb|aaCb|epsilonNow, convert this CFG into CNF. You can follow the below mentioned steps for the successful conversion.Step 1First add a new start symbol S0   S0->S   S->AC|CB   A->aA|a   B->Bb|b   C->aCb|aaCb|epsilonStep 2Next eliminate the epsilon symbol in the production other than the start symbol.   C->epsilon is a null productionAfter eliminating null production, the new productions are as follows −   S0->S   S->AC|CB   A->aA|a   B->Bb|b  ... Read More

Explain Multi tape Turing Machine in TOC?

Bhanu Priya
Updated on 16-Jun-2021 12:28:56

4K+ Views

A Turing machine (TM) with several tapes is called a multi tape Turing machine.Every tape’s have their own Read/Write headFor N-tape Turing MachineM={( Q, X, ∑, δ, q0, B, F)}We define Multi-tape Turing machine as k-tapes with k-tape heads moving independently (generalisation of multi-track Turing machines).δ=QxXN ->Q x XN x {L, R}NEach TM has its own read-write head, but the state is common for all. The multi tape TM is as follows −In each step (transitions), TM reads symbols scanned by all heads, depending on those and current state, each head writes, moves R or L, and control-unit enters into ... Read More

Explain Turing Machine variant Two Stack PDA?

Bhanu Priya
Updated on 16-Jun-2021 12:24:57

12K+ Views

Two stacks push down automata (PDA) includes the following factors −A Turing machine can accept languages that are not accepted by any PDA with one stack.The strength of pushdown automata is increased by adding extra stacks.A PDA with two stacks has the same computation power as for a Turing Machine.Two-Stack PDA is a computational model which is based on the generalization of Pushdown Automata (PDA) and Non-deterministic Two-Stack PDA which is equivalent to a deterministic Two-Stack PDA.The moves of the Two-Stack PDA are based on the following −The state of finite control.The input symbol that reads.The top of the stack ... Read More

Advertisements