Closed flofreud closed 11 years ago
Danny
Out of the situation that comments are standard for programming languages and the "have to be compilable" MS1 examples use them, here a
Proposal: For convenience the language will be extended by a simple line comment construct. Comments are helpful for the description of expected behavior for source language code. Block comments would be nice to have but not essential.
Format: The line comment starts with a '#' and ends with the next '\n'. Lexer-semantic: Normally a lexer would ignore characters belonging to tokens entirely. Contrary to that I and @Tkrauss propose to let the lexer create a token for the comment. This token will be normally ignored by the parser but can be used for the visualization of the lexer work.
If this proposal is accepted I volanteer for adding the comment to the TokenType.
I hardly understand why it should be visualized, that the lexer ignores comments. At most, we can log its work where we do not need a special token. As long as there is no really important and convincing reason to create a special token (work can also be logged, isn't this convincing?), I would not accept.
After a discussion with @flofreud I accept this proposal. The parser can skip the comment tokens but for the visualization, comment tokens are very helpful.
What should be the meaning of # in the add.prog - example? https://github.com/swp-uebersetzerbau-ss13/common/blob/master/examples/m1/add.prog
From context I would infer that it should be a line-comment but we don't have a comment-definition / handling defined yet.