Question: Check the exp - rules.l file to add more rules for my program no Java,C + + or python / * * * * *

Check the exp-rules.l file to add more rules for my program no Java,C++ or python /*********************************************************************
Name: Vishal Murugavel NetID: vm603
Course: CSE 4714
Lab: 01- Lexical Analyzer
Purpose of File: Contains the ....
This is the file that you should modify for Lab 1.
**********************************************************************/
%option noyywrap
%{
#include "lexer.h"
// global variable to hold current line number being read
int line_number =1;
int line_length =0;
int position =0;
char token_value[MAX_TOKEN_LENGTH];
%}
%%
/* Data Values */
"[Ll]aboratory-confirmed case" { return LABORATORY; }
"[Pp]robable Case" { return PROBABLE; }
"[Mm]ale"{ return MALE; }
"[Ff]emale"{ return FEMALE; }
"[Oo]ther"{ return OTHER; }
"[0-9]+-9 Years" { return AGE_0X; }
"[1-9][0-9]+-[1-9][0-9]+ Years" { return AGE_1X; }
"20-39 Years" { return AGE_2X; }
"40-49 Years" { return AGE_4X; }
"50-59 Years" { return AGE_5X; }
"60-69 Years" { return AGE_6X; }
"70-79 Years" { return AGE_7X; }
"80\\+ Years" { return AGE_8X; }
"[Hh]ispanic/[Ll]atino"{ return HISPANIC; }
"[Aa]merican [Ii]ndian \/[Aa]laska [Nn]ative,[Nn]on-[Hh]ispanic"{ return NATIVE_AMERICAN; }
"[Aa]sian,[Nn]on-[Hh]ispanic"{ return ASIAN; }
"[Bb]lack,[Nn]on-[Hh]ispanic"{ return BLACK; }
"[Nn]ative [Hh]awaiian \/[Oo]ther [Pp]acific [Ii]slander,[Nn]on-[Hh]ispanic"{ return PACIFIC_ISLANDER; }
"[Ww]hite,[Nn]on-[Hh]ispanic"{ return WHITE; }
"[Mm]ultiple\/[Oo]ther,[Nn]on-[Hh]ispanic"{ return MULTIPLE_OTHER; }
/* Generic Data Values */
"Yes" { return YES; }
"No"{ return NO; }
"Unknown" { return UNKNOWN_TOKEN; }
"Missing" { return MISSING; }
/* Punctuation */
","{ return SEPARATOR; }
/* Eat newline and increment line number */
{ line_number++; }
/* Eat any remaining whitespace */
[\t\r]+{/* Do nothing */}
/* Found an unknown character */
.{ return UNKNOWN_VALUE; }
/* Recognize end of file */
>{ return EOF_TOKEN; }
/* Match anything else as an unknown token */
.{ return UNKNOWN_TOKEN; }Please add rules to my exprules.l flex file no Java, C++ or python Use flex to generate a lexical analyzer using the language specification shown in the following table. A
set of files that you will use as a starting point for your code is in the attached
Lab01_Starting_Point.zip file.
 Check the exp-rules.l file to add more rules for my program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!