Cop 4020 - your assignment is to read in a start symbol of


- 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 ˜cop4020p/LIB/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 ˜cop4020p/LIB/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).

- You can use the following printf strings to format your output:

"I%d:\n" - set of items number " %-20s goto(%c)=I%d\n" - item with a goto
" %-20s\n" - item without a goto

- You may not assume any limit to the number of productions, items in a set, or the number of sets.

- Submit your *single* source file cparse.c (or cparse.cpp) using the following submit.sh command on shell.cs.fsu.edu
% submit.sh deliverables.sh

The due date for the project will be announced in blackboard course website. A grade of zero will be recorded for missed exams and late assignments unless prior arrangements are made.

Assignments turned in after the due date, but by the beginning of the next schedule class will be penalized 10% . Assignments will not be accepted that are more than one class period late.

- Below is an example input file (cparse.in).
E
E->E+T E->T T->T*F
T->F
F->(E) F->i

- The following output will appear when the above program is input to ~uh/cs450exec/cparse.exe on onyx as follows.

% cparse.exe < cparse.in

Below is the corresponding example output file (cparse.out).

Attachment:- Augmented Grammar.rar

Request for Solution File

Ask an Expert for Answer!!
Dissertation: Cop 4020 - your assignment is to read in a start symbol of
Reference No:- TGS01709320

Expected delivery within 24 Hours