Examples of specifying tokens Example 6. Float .0.5, 3.14, -6.111, 1.0E+3, 100.0, -10.53E-1,9.123E3 Regular expression: Show transcribed image text Examples of specifying tokens Example 6. Float .0.5, 3.14, -6.111, 1.0E+3, 100.0, -10.53E-1,9.123E3 Regular expression:
Answer
Float =
(- + epsilon)(0 + (1+2+…+9)(0+1+2+…+9)*).(0 +(1+2+…+9)(0+1+2+…+9)*)(epsilon + E(- +epsion)(1+2+…+9)(0+1+2+…+9)*)
Explanation
(- + epsilon) is for -ve sign or nothing
(0 + (1+2+…+9)(0+1+2+…+9)*) is to have a number
(epsilon + E(- + epsion)(1+2+…+9)(0+1+2+…+9)*) Either E ornothing