Question: 2.1 Write regular expressions to capture the following. (a) Strings in C. These are delimited by double quotes (),and may not con- tain newline characters.


2.1 Write regular expressions to capture the following. (a) Strings in C. These are delimited by double quotes ("),and may not con- tain newline characters. They may contain double-quote or backslash characters if and only if those characters are "escaped" by a preceding backslash. You may find it helpful to introduce shorthand notation to represent any character that is not a member of a small specified set. (b) Comments in Pascal. These are delimited by ( and *) or by and ( Numeric constants in C. These are octal, decimal, or hexadecimal inte- gers, or decimal or hexadecimal floating-point values. An octal integer begins with 0, and may contain only the digits 0-7. A hexadecimal inte- ger begins with 0x or oX, and may contain the digits 0-9 and a/A-f/F. A decimal floating-point value has a fractional portion (beginning with a dot) or an exponent (beginning with E or e). Unlike a decimal integer it is allowed to start with 0. A hexadecimal floating-point value has an optional fractional portion and a mandatory exponent (beginning wit P or p). In either decimal or hexadecimal, there may be digits to the left of the dot, the right of the dot, or both, and the exponent itself is given in decimal, with an optional leading + or - sign. An integer may end with an optional U or u (indicating "unsigned"), and/or L or 1 (indicating "long") or LL or 11 (indicating"long long"). A floating-point value may 2.1 Write regular expressions to capture the following. (a) Strings in C. These are delimited by double quotes ("),and may not con- tain newline characters. They may contain double-quote or backslash characters if and only if those characters are "escaped" by a preceding backslash. You may find it helpful to introduce shorthand notation to represent any character that is not a member of a small specified set. (b) Comments in Pascal. These are delimited by ( and *) or by and ( Numeric constants in C. These are octal, decimal, or hexadecimal inte- gers, or decimal or hexadecimal floating-point values. An octal integer begins with 0, and may contain only the digits 0-7. A hexadecimal inte- ger begins with 0x or oX, and may contain the digits 0-9 and a/A-f/F. A decimal floating-point value has a fractional portion (beginning with a dot) or an exponent (beginning with E or e). Unlike a decimal integer it is allowed to start with 0. A hexadecimal floating-point value has an optional fractional portion and a mandatory exponent (beginning wit P or p). In either decimal or hexadecimal, there may be digits to the left of the dot, the right of the dot, or both, and the exponent itself is given in decimal, with an optional leading + or - sign. An integer may end with an optional U or u (indicating "unsigned"), and/or L or 1 (indicating "long") or LL or 11 (indicating"long long"). A floating-point value may
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
