
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 205 Articles for Computer Programming

1K+ Views
SolutionNFA for the above language will be −Conversion from NFA to DFA −ε − closure(0) = {0, 1, 4} = AFor State AFor input symbol aFor input symbol bFor input symbol c∴ Ta = {2}∴ Tb = {5}Tc = ∅∴ ε − closure (Ta) = ε − closure (2)= {2} = B∴ ε − closure (Tb) = ε ... Read More

3K+ Views
Deterministic means that on each input there is one and only one state to which the automata can have the transition from its current state. In deterministic finite automata, the head can move only in one direction to scan the input tape symbols. But in the case of two-way, finite automata on scanning an input symbol the head of the tape may move in right or left from its current position.A deterministic finite automata is a set of 5 tuples and defined asM = (Q, Σ, δ, q0, F)Q: A non-empty finite set of states present in the finite control ... Read More

7K+ Views
Shift reduce parser is a type of bottom-up parser. It uses a stack to hold grammar symbols. A parser goes on shifting the input symbols onto the stack until a handle comes on the top of the stack. When a handle occurs on the top of the stack, it implements reduction.There are the various steps of Shift Reduce Parsing which are as follows −It uses a stack and an input buffer.Insert $ at the bottom of the stack and the right end of the input string in Input Buffer.Shift: Parser shifts zero or more input symbols onto the stack until ... Read More

13K+ Views
In top-down parsing, the parse tree is generated from top to bottom, i.e., from root to leaves & expand till all leaves are generated.It generates the parse tree containing root as the starting symbol of the Grammar. It starts derivation from the start symbol of Grammar & performs leftmost derivation at each step.Drawback of Top-Down ParsingTop-down parsing tries to identify the left-most derivation for an input string ω which is similar to generating a parse tree for the input string ω that starts from the root and produce the nodes in a pre-defined order.The reason that top-down parsing follow the ... Read More

15K+ Views
Parsing is known as Syntax Analysis. It contains arranging the tokens as source code into grammatical phases that are used by the compiler to synthesis output generally grammatical phases of the source code are defined by parse tree. There are various types of parsing techniques which are as follows −Top-Down ParserIt generates the Parse Tree from root to leaves. In top-down parsing, the parsin begins from the start symbol and changes it into the input symbol.An example of a Top-Down Parser is Predictive Parsers, Recursive Descent Parser.Predictive Parser − Predictive Parser is also known as Non-Recursive Predictive Parsing. A predictive ... Read More

52K+ Views
The lexical analysis is the first phase of the compiler where a lexical analyser operate as an interface between the source code and the rest of the phases of a compiler. It reads the input characters of the source program, groups them into lexemes, and produces a sequence of tokens for each lexeme. The tokens are sent to the parser for syntax analysis.If the lexical analyzer is located as a separate pass in the compiler it can need an intermediate file to locate its output, from which the parser would then takes its input. It can eliminate the need for ... Read More

20K+ Views
A Grammar that makes more than one Leftmost Derivation (or Rightmost Derivation) for the similar sentence is called Ambiguous Grammar.Example − Verify whether the following Grammar is Ambiguous or Not.E → E+E|E $\ast$ E|idSolutionFor string id + id * id, there exist two parse trees.E ⇒lm $\underline{E}$+E ⇒ id+ $\underline{E}$⇒ id+$\underline{E}$ $\ast$ E⇒ id+id $\ast$ $\underline{E}$⇒ id+id $\ast$ idE ⇒lm $\underline{E}$ $\ast$ E⇒ $\underline{E}$+E $\ast$ E⇒ id+ $\underline{E}$ $\ast$ E⇒ id+id $\ast$ $\underline{E}$⇒ id+id $\ast$ idSo, the same string is generated using two different leftmost derivations. Each is having a different parse tree.∴ Two different parse trees exist for string id + id ... Read More

5K+ Views
Derivations mean replacing a given string’s non-terminal by the right-hand side of the production rule. The sequence of applications of rules that makes the completed string of terminals from the starting symbol is known as derivation.It can derive terminal strings, beginning with the start symbol, by repeatedly replacing a variable with some production. The language of CFG is a set of terminal symbols we can derive so. This language is called context Free Language.Derivations are denoted by ⇒.For example, consider a Grammar.G=({S}, {a, b}, P, S), where, P contains following productions −P={S→aSa |bSb | ∈}In the above, S may be ... Read More

6K+ Views
Grammar − It is a set of rules which checks whether a string belongs to a particular language a not.A program consists of various strings of characters. But, every string is not a proper or meaningful string. So, to identify valid strings in a language, some rules should be specified to check whether the string is valid or not. These rules are nothing but make Grammar.Example − In English Language, Grammar checks whether the string of characters is acceptable or not, i.e., checks whether nouns, verbs, adverbs, etc. are in the proper sequence.Context-Free GrammarIt is a notation used to specify ... Read More

12K+ Views
Lexical Analysis is the first step of the compiler which reads the source code one character at a time and transforms it into an array of tokens. The token is a meaningful collection of characters in a program. These tokens can be keywords including do, if, while etc. and identifiers including x, num, count, etc. and operator symbols including >, >=, +, etc., and punctuation symbols including parenthesis or commas. The output of the lexical analyzer phase passes to the next phase called syntax analyzer or parser.The syntax analyser or parser is also known as parsing phase. It takes tokens ... Read More