[SOLVED] html compiler CS 441 Fall 2019 Homework 3 Due: Tue Dec 10

$25

File Name: html_compiler_CS_441__Fall_2019_Homework_3_Due:_Tue_Dec_10.zip
File Size: 546.36 KB

5/5 - (1 vote)

CS 441 Fall 2019 Homework 3 Due: Tue Dec 10
Write a lex script that lexemizes and validates input for a calculator, using the specifications given below. Write it in a text file called calc.l
Input to the scanner program should be from the standard input, and output to the standard output. The scanner should print one lexeme per line. When an error is found, it should print error followed
by the current yytext on a line. Note scanning will continue after an error until end of input. Use lex to create the scanner program:
lex calc.l creates lex.yy.c Use gcc to compile the scanner program with the flf options:
gcc lfl lex.yy.c creates a.out
A test file, along with my executable (scan), are given on Multilab in:
~kwjoiner/441/lex/
You may test the scanner using the test file by redirecting the file into the standard input:
a.out < t.txtYou may also test simply by running the a.out executable. It will wait for you to enter characters into the standard input (keyboard). Press ENTER and it will scan, print results, and wait for more input. To exit the program, use ctrl-d.Calculator Lexeme Specifications:- any sequence of one or more whitespaces constitutes a delimiter between lexemes. Whitespace includes blank, tab and newline. Whitespaces are discarded (should not be output)- A value is defined as:o oneormoredigitso optionallyfollowedby a period (decimal point) followed by one or more digits (so, at least 1 digit after a decimal point)- Simple one-character lexemes include:o operators:+-/*=o parenthesis: ( )- Note:2*-3will parse as2 * – 3and not as2 * -3lex manual:http://dinosaur.compilertools.net/lex/index.html(or search the internet…there are some other lex web sites) Submit in Canvas: only your calc.l file

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] html compiler CS 441 Fall 2019 Homework 3 Due: Tue Dec 10
$25