Share
Explore BrainMass

Scanner classification of symbols enclosing the comment

In some programming languages a comment can be enclosed either in braces {} or in the symbols (* *). How do you think a scanner would group the four symbols {, }, (*, *) for purposes of classification i.e. would each symbol be given its own classification number or would some share classifications?

Solution Preview

Each of the mentioned symbols should be given it's own classification number. The way left parenthesis has to match right parenthesis, similarly start of comment has to match the end of comment. If symbols indicating start and end of comment are given same classification, then we won't be able to identify a comment correctly.

If we gave same ...

Solution Summary

Solution justifies the answer with the help of relevent examples/case analysis.

$2.19