Reference no: EM133030759
System Programming
Consider a csv file (comma separated values) which contains a header followed by five-tuples
A, B, C, D, E
a1,b1,c1,d1,e1
a2,b2,c2,d2,e2
a3,b3,c3,d3,e3
...
the values in csv file have the description:
ai stands for a row number (integer)
bi stands for a column number (integer)
ci stands for a description string (alphanumeric) which is row-name
di stands for a description string (aphanumeric) which is column-name
ei is the value at row number ai, having row-name ci, and column number bi, having column- name di
This file is to be converted into an HTML table code with usual tags <table>, <thead>,<th>,
<tr>,<td>,<tbody>, and <tfoot>
You need to:
1. Write regular expressions and Grammar for the purpose
2. Use lex and yacc (flex and bison) to generate a translator that reads the csv file and generates the correponding HTML code, if the csv file is in proper format (i.e., header and each row is a 5 tuple, no extraneous/dirty data, and datatypes of values as described), or print appropriate error message.
3. Upload the following:
(a) lex and yacc code files you made
(b) your translator (executable file)
(b) Document explaining you design, code and usage
(c) Input file(s), generated HTML output and screen-shots of the execution
Important: The table may be such that m x 5 table may not have all cells with a value, in such case, <td></td> signifies an empty cell. The row/column numbers in csv file need not be in proper (ascending or right-to-left) order, but will uniquely resolve to a table cell. In case uniqueness is not there (i.e. duplicate specification), an error needs to be flagged.
data.csv (cross check with HTML table carefully to understand the data)
RowNo,ColNo,RowName,ColName,Value 1,1,RowHeader,ColHeader,Y.No 1,2,RowHeader,ColHeader,Year 1,3,RowHeader,ColHeader,January-April 1,4,RowHeader,ColHeader,May-August 1,5,RowHeader,ColHeader,September-December 2,1,,Y.No,1
3,1,,Y.No,2
4,1,,Y.No,3
5,1,,Y.No,4
6,1,,Y.No,5
7,1,,Y.No,6
8,1,,Y.No,7
9,1,,Y.No,8
10,1,,Y.No,9
11,1,,Y.No,10
12,1,ColFooter,Y.No,, 3,2,1,Year,2001-02
4,2,2,Year,2002-03
5,2,3,Year,2003-04
6,2,4,Year,2010-11
7,2,5,Year,2011-12
8,2,6,Year,2012-13
9,2,7,Year,2016-17
10,2,8,Year,2017-18
11,2,9,Year,2018-19
12,2,10,Year,2019-20
2,3,1,January-April,3000 2,5,1,September-December,750.85 3,3,2,January-April,9115 3,4,2,May-August,815 3,5,2,September-December,400 4,4,3,May-August,662 4,5,3,September-December,0.75
5,3,4,January-April,Not Applicable 5,4,4,May-August,190 5,5,4,September-December,2200 7,4,6,May-August,1190 8,5,7,September-December,6133 10,3,9,January-April,510 10,4,9,May-August,Not Applicable 11,4,10,May-August,443 12,2,ColFooter,Year,,
12,3,ColFooter,January-April,Trimester-1 12,4,ColFooter,May-August,Trimester-2 12,5,ColFooter,September-December,Trimester-3
Note that:
1. RowHeader,ColHeader,ColFooter are special names
2. where empty string is meant comma repeats, that is each line is 5-tuple
3. empty cells are not included in file, except if they are in header or footer (this keeps csv short for sparse tables. You might decide to add these as a preprocessing step, but it may actally be unnecessary)
4. Row and Column names can be seen as additional check to verify correct placement of data using row and column numbers. You may, however, sacrifice these for first prototype, but need to include them eventually.
Attachment:- System Programming.rar