Question: Q2. Suppose that in a programming language decimal, binary and hexadecimal literals can be assigned to an unsigned integer variable. Decimal literals consist of one


Q2. Suppose that in a programming language decimal, binary and hexadecimal literals can be assigned to an unsigned integer variable. Decimal literals consist of one or more digits, and do not begin with zero (O). To specify a binary literal, the prefix Ob or OB is added to the binary number. To specify a hexadecimal literal, the prefix Ox or OX is added to the hexadecimal number. Any length constraint specifying the number of digits in literals should not be taken into consideration in your solution. The following are examples: 20, 105, 68930, are decimal literals. 0b101, 060101, OB101, are binary literals 0x9A4, OxE3F, 0X87C, -- are hexadecimal literals. a) Define the syntax for those literals using BNF (Backus-Naur Form) notation. (L b) Build a deterministic finite state machine that will recognize those literals. (L U
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
