Run your program; several examples to demonstrate correctness; State what is bei
ID: 3786228 • Letter: R
Question
Run your program; several examples to demonstrate correctness; State what is being illustrated
Format the submission to make it understandable
README: how to build & run your programs
files for each section of the assignment (3 different problems)
Part 1 & 2: develop Lex files that solve the “version 1” and “version 2” problems from A2. The expectations for each section remains the same. The output from the Lex-generated scanner should be quite similar to that produced by your hand-coded solution from A2.
Part 1:
L : letter
D : digit
w : whitespace
P : any other character
Part 2:
n : number 1 or more digits
s : string 1 or more letters
o : operator +,-,*,/,%,<,<=,>,>=,==,!=
p : punctuation some other symbol
w : whitespace 1 or more whitespaces (again keep line-by-line organization)
Part 3: Language to implement
Hex & Decimal literals:Input - sequence of characters; terminated with a q
When you see a q, scanning stops
Identify hex literals in the input
0x### where ### represents a sequence of hex digits (0-9,A-F).
Identify decimal literals (for positive integers)
Made up of digits 0-9
Other information is suppressed & not printed
Sample output:
Output is not really side-by-side it is just displayed in a table for ease of understanding & matching; Frequently, output will be displayed after each line
Hex & Dec
Input
Output
this is a dec 12--
and a hex 0x4af2--
24 < 0x3a or more
q 28 < 0x44 or more
DEC: 12
HEX: 0x4af2
DEC: 24
HEX: 0x3a
...
Hex & Dec
Input
Output
this is a dec 12--
and a hex 0x4af2--
24 < 0x3a or more
q 28 < 0x44 or more
DEC: 12
HEX: 0x4af2
DEC: 24
HEX: 0x3a
...
Explanation / Answer
The following variables are initialized to the same value:
The following variables are also initialized to the same value:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.