Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago