- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 213 Articles for Computer Programming
5K+ 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
8K+ 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
23K+ Views
It is a tool or software which automatically generates a lexical analyzer (finite Automata). It takes as its input a LEX source program and produces lexical Analyzer as its output. Lexical Analyzer will convert the input string entered by the user into tokens as its output.LEX is a program generator designed for lexical processing of character input/output stream. Anything from simple text search program that looks for pattern in its input-output file to a C compiler that transforms a program into optimized code.In program with structure input-output two tasks occurs over and over. It can divide the input-output into meaningful ... Read More
3K+ Views
Minimizing means reducing the number of states in DFA. We have to detect those states of DFA whose presence or absence in DFA does not affect language accepted by DFA. These states can be eliminated from DFA.Algorithm: Minimization of DFAInput − DFA D1 with a set of states Q with a set of final states F.Output − DFA D2 which accepts the same language as D1 and having a minimum number of states as possible.MethodMake a partition 'π' of a set of states with two subsets −Final state 'F'Non-Final States 'Q-F'∴ π={F, Q−F}To apply the following procedure to make πnew ... Read More
824 Views
Yes, we can convert a NFA into DFA. For every NFA there exists an equivalent DFA. The equivalence is defined in terms of languages acceptance. Since NFA is nothing but a finite automata in which zero, one or more transitions on an input symbols are permitted. It can always construct finite automata which will simulate all moves of DFA on a particular input symbol in parallel, then get a finite automata in which there will be exactly one transition on every input symbol. Here, corresponding to a NFA there exist a DFA. To construct DFA equivalent to NFA, it should ... Read More
2K+ Views
Non-Deterministic means that there can be several possible transitions on the same input symbol from some state. The output is non-deterministic for a given input. NFA can be represented as a nondeterministic finite state machine.NFA can be represented by 5 tuples (Q, $\sum$, $\delta$, q0, F)Q is a finite non-empty set of states.$\sum$ is a finite set of input symbols.$\delta$ is the transition function to move from the current state to the next state.∴ $\delta$:Q x $\sum$ → 2Qq0 ∈ Q is the initial state.F \subseteq Q is the set of final states.Example1 − Draw NFA for the Regular Expression ... Read More
1K+ 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, Σ, $\delta$, q0, F) where, Q: A non-empty finite set of states present in the finite control ... Read More
21K+ Views
A Regular Expression is a representation of Tokens. But, to recognize a token, it can need a token Recognizer, which is nothing but a Finite Automata (NFA). So, it can convert Regular Expression into NFA.Algorithm for the conversion of Regular Expression to NFAInput − A Regular Expression ROutput − NFA accepting language denoted by RMethodFor ε, NFA isFor a NFA isFor a + b, or a | b NFA isFor ab, NFA isFor a*, NFA isExample1 − Draw NFA for the Regular Expression a(a+b)*abSolutionExample2 − Draw NFA for a + b + abSolutionExample3 − Draw NFA for letter (letter+digit)*SolutionExample4 − ... Read More
3K+ Views
An automata is an abstract model of digital computers with discrete inputs and outputs. Every automata include a mechanism for reading inputs. It is considered that input is a string over a given alphabet, written on an input file that the automata can read. The input file is divided into smaller parts known as cells.It is a Machine or a Recognizer for a language that is used to check whether a language accepts the string or not. In Finite Automata, Finite means a finite number of states and Automata means the Automatic Machine which works without any interference of human ... Read More
3K+ Views
The language accepted by finite automata can be simply defined by simple expressions known as Regular Expressions. It is an effective approach to describe any language. A regular expression can also be represented as a sequence of patterns that represent a string. Regular expressions are used to connect character sequence in strings. The string searching algorithm used this pattern to discover the operations on a string.There are various rules for regular expressions which are as follows −ε is a Regular expression.Union of two Regular Expressions R1 and R2.i.e., R1 + R2 or R1|R2 is also a regular expression.Concatenation of two ... Read More