I have a compiler homework question that wants me to draw a DFA for Pascal comments, but I have never (and probably never will) use Pascal. The question does not specify if we should use ANSI Pascal or Turbo Pascal, so I was going to do one for both.
Some Google searches showed me that Turbo Pascal allows nested comments as long as the same delimiter is not used, so {(*comment*)}
is ok and so is (*{comment}*)
, but {{comment}}
or (*(*comment*)*)
are not ok. My question here is if a comment like {(*{comment}*)}
or (*{(*comment*)}*)
is ok since the same delimiters are not used in a row.
I also Googled to see if ANSI Pascal allowed nested comments, but I have not found a definitive answer. If ANSI Pascal does allow nested comments, what are the rules?
On a side note, I am not worried about the strange commenting convention of different starting and ending delimiters, a convention that is allowed in ANSI Pascal.
UPDATE:
I would like to be clear that I am not really concerned with how specific compilers handle Pascal comments, I am concerned with how a compiler SHOULD handle Pascal comments if that compiler adhered 100% to either the ANSI or TURBO Pascal standards.