Cop 4020 assignment cparse read in a start symbol of a set


Assignment cparse

Your assignment is to read in a start symbol of a set of productions followed by the set of productions from stdin and produce the collection of sets of LR(0)  items  to stdout. An example input file is given on the next page and is in the ~uh/proj3/cparse.in file. The program makes the following assumptions about the input.

(1) The start symbol is the first character on the first line.

(2) Productions start at the beginning of each of the following lines and are of the form N->rhs, where N is a nonterminal and rhs is a string of nonterminals and terminals. A "|" representing alternative rhs's is not allowed.

(3) A nonterminal is a single uppercase letter.

(4) A terminal is a single character that is not an uppercase letter, "@", or a "'".

The output consists of two parts. First, the augmented grammar should be printed. Next, the sets of LR(0) items will be printed. An example output file is given on the next page and is in the ~uh/proj3/cparse.out file.  The form of your output should match my output exactly, which will facilitate grading.  The program makes the following assumptions about the output.

(1) The position is represented with a "@".

(2) The augmented grammar start symbol is represented by a "'".

(3) A set of items is represented by the form I#, where # is a number.  Sets are numbered starting from zero.

(4) The size of an item is no more than 20 characters (including a NULL character).

Attachment:- Assignment File.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Cop 4020 assignment cparse read in a start symbol of a set
Reference No:- TGS02485729

Expected delivery within 24 Hours