
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

2K+ Views
There are two types of Top-Down Parsing without Backtracking, which are as follows −Recursive Descent ParserPredictive ParserRecursive Descent ParserA top-down parser that implements a set of recursive procedures to process the input without backtracking is known as recursive-descent parser, and parsing is known as recursive-descent parsing. The recursive procedures can be accessible to write and adequately effective if written in a language that performs the procedure call effectively.There is a procedure for each non-terminal in the grammar. It can consider a global variable lookahead, influencing the current input token and a procedure match (Expected Token) is the action of recognizing ... Read More

2K+ Views
A Grammar G (V, T, P, S) is left recursive if it has a production in the form.A → A α |β.The above Grammar is left recursive because the left of production is occurring at a first position on the right side of production. It can eliminate left recursion by replacing a pair of production withA → βA′A → αA′|ϵThe general form for left recursion isA → Aα1|Aα2| … . |Aαm|β1|β2| … . . βncan be replaced byA → β1A′|β2A′| … . . | … . . |βnA′A → α1A′|α2A′| … . . |αmA′|εIn the following grammar, it does not ... Read More

9K+ Views
In Top-Down Parsing with Backtracking, Parser will attempt multiple rules or production to identify the match for input string by backtracking at every step of derivation. So, if the applied production does not give the input string as needed, or it does not match with the needed string, then it can undo that shift.Example1 − Consider the GrammarS → a A dA → b c | bMake parse tree for the string a bd. Also, show parse Tree when Backtracking is required when the wrong alternative is chosen.SolutionThe derivation for the string abd will be −S ⇒ a A d ⇒ ... Read More

4K+ Views
Precedence relations between any two operators or symbols in the precedence table can be converted to two precedence functions f & g that map terminals symbols to integers.If a g (b)Here a, b represents terminal symbols. f (a) and g (b) represents the precedence functions that have an integer value.Computations of Precedence FunctionsFor each terminal a, create the symbol fa&ga.Make a node for each symbol. If a =. b, then fa & gb are in same group or node. If a =. b & c =. b, ... Read More

560 Views
OPG stands for Operator Precedence Grammar. Grammar with the later property is known as operator precedence grammar. It is ε −free Operator Grammar in which precedence relation are disjoint, i.e., If a . > b exists, then b .> a will not exist.Example1 − Verify whether the following Grammar is operator Grammar or not.E → E A E |(E)|idA → +| − | *SolutionNo, it is not an operator Grammar as it does not satisfy property 2 of operator Grammar.As it contains two adjacent Non-terminals on R.H.S of production E → E A E .We can convert it into ... Read More

10K+ Views
A handle is a substring that connects a right-hand side of the production rule in the grammar and whose reduction to the non-terminal on the left-hand side of that grammar rule is a step along with the reverse of a rightmost derivation.Finding Handling at Each StepHandles can be found by the following process −It can scan the input string from left to right until first .> is encountered.It can scan backward until

579 Views
For terminals a and b in an Operator Grammar we can have the following precedence Relations −a =. b(Equal Precedence) − If R.H.S of production is of form α a β b γ, where β can be ε or single non-terminal then a =. b.Here, α and γ can be any strings.Example − In grammar, S → m A c B e dOn Comparing mAcBed with αaβbγα = mA, a = c, β = B, b = e, γ = dΑAβbγmACBedSo, comparing a with c and b with e we get c =.e.We can also make a different combination for ... Read More

7K+ Views
Any string of Grammar can be parsed by using stack implementation, as in shift Reduce parsing. But in operator precedence parsing shifting and reducing is done based on Precedence Relation between symbol at the top of stack & current input symbol of the input string to be parsed.The operator precedence parsing algorithm is as follows −Input − The precedence relations from some operator precedence grammar and an input string of terminals from that grammar.Output − There is no output but it can construct a skeletal parse tree as we parse, with one non-terminal labeling all interior nodes and the use ... Read More

14K+ Views
LEADINGIf production is of form A → aα or A → Ba α where B is Non-terminal, and α can be any string, then the first terminal symbol on R.H.S isLeading(A) = {a}If production is of form A → Bα, if a is in LEADING (B), then a will also be in LEADING (A).TRAILINGIf production is of form A→ αa or A → αaB where B is Non-terminal, and α can be any string then, TRAILING (A) = {a}If production is of form A → αB. If a is in TRAILING (B), then a will be in TRAILING (A).Algorithm to ... Read More

13K+ Views
Operator Precedence Parsing is also a type of Bottom-Up Parsing that can be used to a class of Grammars known as Operator Grammar.A Grammar G is Operator Grammar if it has the following properties −Production should not contain ϵ on its right side.There should not be two adjacent non-terminals at the right side of production.Example1 − Verify whether the following Grammar is operator Grammar or not.E → E A E |(E)|idA → +| − | ∗SolutionNo, it is not an operator Grammar as it does not satisfy property 2 of operator Grammar.As it contains two adjacent Non-terminals on R.H.S of ... Read More