Explore BrainMass

Scanner classification of symbols enclosing the comment

This content was STOLEN from BrainMass.com - View the original, and get the solution, here!

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?

© BrainMass Inc. brainmass.com September 25, 2018, 2:57 pm ad1c9bdddf - https://brainmass.com/computer-science/programming-languages/scanner-classification-of-symbols-enclosing-the-comment-211533

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.