Question: PLEASE CODE IN C++ USING VECTORS!! 4.3 Task 3: Calculate FIRST Sets Compute the FIRST sets of all non-terminals. Then, for each of the non-terminals
PLEASE CODE IN C++ USING VECTORS!!


4.3 Task 3: Calculate FIRST Sets Compute the FIRST sets of all non-terminals. Then, for each of the non-terminals of the input grammar, in the order that it appears in the grammar, output one line in the following format: FIRST() { } Where should be replaced by the non-terminal and should be replaced by a comma-separated list of elements of the set ordered in the following manner: lfe belongs to the set, represent it as # If e belongs to the set, it should be listed before any other elements All other elements of the set should be sorted in the order in which they appear in the grammar Example: Given the input grammar decl-> idList colon ID # idList-> ID idList1 # idList! -> # idList1-) COMMA ID idList 1 # the expected output for task 3 is FIRST (decl) - ID j FIRST (idlist) = { ID } FIRST (idList 1) { #, COMMA } 4.4 Task 4: Calculate FOLLOW Sets For each of the non-terminals of the input grammar, in the order that they appear in the non- terminals section of the input, compute the FOLLOW set for that non-terminal and output one line in the following format FOLLOW () { } = Where should be replaced by the non-terminal and should be replaced by the comma-separated list of elements of the set ordered in the following manner: o If EOF belongs in the set, represent it as $ If EOF belongs in the set, it should be listed before any other elements o All other elements of the set should be sorted in the order in which they appear in the grammar 4.3 Task 3: Calculate FIRST Sets Compute the FIRST sets of all non-terminals. Then, for each of the non-terminals of the input grammar, in the order that it appears in the grammar, output one line in the following format: FIRST() { } Where should be replaced by the non-terminal and should be replaced by a comma-separated list of elements of the set ordered in the following manner: lfe belongs to the set, represent it as # If e belongs to the set, it should be listed before any other elements All other elements of the set should be sorted in the order in which they appear in the grammar Example: Given the input grammar decl-> idList colon ID # idList-> ID idList1 # idList! -> # idList1-) COMMA ID idList 1 # the expected output for task 3 is FIRST (decl) - ID j FIRST (idlist) = { ID } FIRST (idList 1) { #, COMMA } 4.4 Task 4: Calculate FOLLOW Sets For each of the non-terminals of the input grammar, in the order that they appear in the non- terminals section of the input, compute the FOLLOW set for that non-terminal and output one line in the following format FOLLOW () { } = Where should be replaced by the non-terminal and should be replaced by the comma-separated list of elements of the set ordered in the following manner: o If EOF belongs in the set, represent it as $ If EOF belongs in the set, it should be listed before any other elements o All other elements of the set should be sorted in the order in which they appear in the grammar