Cop 4020 assignment - cparse your assignment is to read in


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 ˜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 non-terminal and rhs is a string of non-terminals and terminals. A "|" representing alternative rhs's is not allowed.

(3) A non-terminal 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

Attachment:- Project Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Cop 4020 assignment - cparse your assignment is to read in
Reference No:- TGS01668428

Expected delivery within 24 Hours