.. (לתיקייה המכילה) | ||
My regexes are problematic. | |
Use a regex debugger! They let you see exactly what part of the string matches what. Here is a good one, but there are many others. Just be sure you use one that doesn't see . as "any character" but "any character other than \n". | |
קישור: Link: Ссылка: وصلة: | http://regexr.com/ |
Which token are case sensitive and which are not? | |
The digits of hexadecimal numbers are case insensitive (0x1f and 0x1F are equivalent, 0x1 and 0X1 are not) Other than that everything is case sensitive. |
Can string contain the characters " and '? | |
Strings of the first kind cannot contain '. Strings of the second kind cannot contain " (unless escaped, \"). |
Is there a limit on the length of the input? | |
You can assume that the input won't be longer than 1024 characters |
Can we assume integer values won't exceed an int? | |
Yes |
Can the TYPE, DECLARATION and DEREFERENCE tokens have empty strings? | |
No, they must include at least one character. |
Can a VAL start with a digit? | |
No, VALs should start with a letter. |
Can strings contain tabs? | |
Yes, they can. String might also contain CR and LF characters (which should be handled as explained in the hw) |
What should we in case of an error? | |
All errors should be dealt by printing an appropriate error message and calling exit(0) |
STRING and COMMENT state we should consider CR and LF as newlines. Is CRLF two new lines or one? | |
CR, LF and CRLF all represent a single newline. |
Should we remove extra zeroes from integers? Should we remove the sign number for positive integers? | |
Yes. +12 should be printed as 12. 05 should be printed as 5. |
Can we assume yylineno holds the right value for the line number? | |
Yes |
The hw states that in escape sequence of the form \xdd the value won't exceed 277 hexadecimal or 255 decimal. Those values don't match. | |
Correct, that was a mistake. You can assume that the value won't exceed 255 decimal which is 0xFF hexadecimal. |
In case of an unclosed string containing an undefined escape sequnence, which error should we report? | |
As a general rule, always report the first error you encounter when reading the input. In this case, you will always read the undefined escape sequence before you can determine the string is unclosed. Therefore, you should report the escape sequence. |