Find First and Follow for the Following Grammar

Ginni
Updated on 01-Nov-2021 12:27:42

7K+ Views

SolutionComputation of FIRSTE →TE′Applying Rule (4b) of FIRSTSince FIRST (T) does not contain ε, or T does not derive ε.∴ FIRST (E) = FIRST(TE′) = FIRST(T)∴ FIRST (E) = {FIRST(T)} (1)E → +TE′|εApplying Rule (3) of FIRSTComparing E′ → +TE′with X → aα∴ FIRST(E′) = {+}Apply Rule (2) on E′ → εFIRST (E′) = {ε}∴ FIRST(E′) = {+, ε} (2)T→FT′Apply rule (4b) of FIRSTSince, FIRST(F) does not derive ε∴ FIRST(T) = FIRST(FT′) = FIRST(F)∴ FIRST(T) = {FIRST(F)} (3)T′→*FT′|εComparing with rule (2) & (3) of FIRST, we get∴ FIRST(T′) = {ε, ∗} (4)F→(E)|idComparing with rule (3) of FIRST∴ FIRST(F) = {(, ... Read More

Find First and Follow for the Given Grammar

Ginni
Updated on 01-Nov-2021 11:40:07

1K+ Views

SolutionComputation of FIRSTA → b B∴ FIRST(A) = {b}B → ε∴ FIRST(B) = {ε}S → A a AApplying Rule (4) of FIRSTi.e., Comparing S → A a A with X → Y1Y2Y3∴ FIRST (S) = FIRST (A a A) = FIRST (A) = {b}∴ FIRST(S) = {b}S → B b B∵ FIRST (B)contains ε or B derives ε ∴ Applying Rule (4c)∴ FIRST (S) = FIRST (B to B)∴ FIRST (S) = FIRST (B) − {ε} ∪ FIRST(bB)∴ FIRST (S) = FIRST (B) − {ε} ∪ {b} = {ε} − {ε} ∪ {b} = {b}∴ FIRST (A) = {b}FIRST (B) ... Read More

First and Follow Sets in Compiler Design

Ginni
Updated on 01-Nov-2021 11:29:30

64K+ Views

FIRST and FOLLOW are two functions associated with grammar that help us fill in the entries of an M-table.FIRST ()− It is a function that gives the set of terminals that begin the strings derived from the production rule.A symbol c is in FIRST (α) if and only if α ⇒ cβ for some sequence β of grammar symbols.A terminal symbol a is in FOLLOW (N) if and only if there is a derivation from the start symbol S of the grammar such that S ⇒ αNαβ, where α and β are a (possible empty) sequence of grammar symbols. In ... Read More

What is a Predictive Parser

Ginni
Updated on 01-Nov-2021 11:25:36

21K+ Views

Predictive Parser is also another method that implements the technique of Top- Down parsing without Backtracking. A predictive parser is an effective technique of executing recursive-descent parsing by managing the stack of activation records, particularly.Predictive Parsers has the following components −Input Buffer − The input buffer includes the string to be parsed followed by an end marker $ to denote the end of the string.Here a, +, b are terminal symbols.Stack − It contains a combination of grammar symbols with $ on the bottom of the stack. At the start of Parsing, the stack contains the start symbol of Grammar ... Read More

Check Matrix Values Equality with Vector Values in R

Nizamuddin Siddiqui
Updated on 01-Nov-2021 10:44:14

258 Views

If we have a vector called V that contains five values and a matrix say M that contains five columns and we want to check whether first value in the vector is present in the first column of each row in the matrix and so on for each value in the vector then we can use the below command −t(t(M)==V)Example 1Consider the below matrix and vector −M1

Find Row Means for Columns Starting with a String in R Data Frame

Nizamuddin Siddiqui
Updated on 01-Nov-2021 10:23:12

997 Views

To find the row means for columns starting with specific string in an R data frame, we can use mutate function of dplyr package along with rowMeans function.For Example, if we have a data frame called df that contains three columns say x1_x2, x1_x3, x1_x2 and we want to find the row means for columns x1_x2 and x1_x3 then, we can use the below command −df%%mutate(X1_Cmbn=select(.,starts_with("x1_")) %% rowMeans())Example 1Following snippet creates a sample data frame −Grp1_x

Find Row Mean for Selected Columns in R Data Frame

Nizamuddin Siddiqui
Updated on 01-Nov-2021 09:56:41

3K+ Views

To find the row mean for selected columns in R data frame, we can use mutate function of dplyr package along with rowMeans function.For Example, if we have a data frame called df that contains three columns say X, Y, and Z then mean of each row for columns X and Y can be found by using the below command −df %% mutate(X_Y_Mean=select(.,c("X","Y")) %% rowMeans())Example 1Following snippet creates a sample data frame −x1

Different Participants of Defect Life Cycle

Vineet Nanda
Updated on 01-Nov-2021 08:50:11

361 Views

What Exactly is a Defect?A fault or error in an application that restricts the usual flow of the application by mismatching the expected behavior of an application with the real one is referred to as a defect.A defect happens when a developer makes a mistake when developing or constructing an application. When a tester discovers this error, it is referred to as a defect.A tester must thoroughly test an application to identify as many flaws as possible to guarantee that a quality product reaches the consumer. Before going on to the workflow and different phases of the defect, it is ... Read More

Curve Fitting Models in Software Engineering

Vineet Nanda
Updated on 01-Nov-2021 08:34:52

967 Views

Curve fitting is the process of constructing a curve, or mathematical function, that best fits a set of data points, subject to constraints. Curve fitting can include either interpolation, which requires a precise fit to the data, or smoothing, which involves creating a "smooth" function that approximates fits the data.Regression analysis is a similar topic that focuses on statistical inference problems such as how much uncertainty is present in a curve that is fit to data seen with random errors.Fitted curves can be used to help in data visualization, predict function values when no data is provided, and describe the ... Read More

Find Column and Row Names in R Data Frame Based on Condition

Nizamuddin Siddiqui
Updated on 01-Nov-2021 08:28:55

8K+ Views

To find the column names and row names in an R data frame based on a condition, we can use row.names and colnames function. The condition for which we want to find the row names and column names can be defined inside these functions as shown in the below Examples.Example 1Following snippet creates a sample data frame −x1

Advertisements