258A3 - CSC258 Computer Organization 2010 winter Assignment...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC258 Computer Organization 2010 winter Assignment 3 due Mon.Mar.29 at 5pm in BA2220 1[40] Write a program in CSC258 assembly language to check whether parenthesis pairs ( ) [ ] { } are matched properly. The input is any sequence of characters, using the character # to mean the end of input. The output echoes the input until either an error is detected or the # character is input, and then a message saying either MATCH or ERROR is printed. In the case of error, the offending parenthesis is also printed. For example, if the input is This (sentence [doesn't]) make {much sense}, but (it has (a lot ( )of parentheses)) in it.# then the output is This (sentence [doesn't]) make {much sense}, but (it has (a lot ( )of parentheses)) in it. MATCH If the input is This (sentence [doesn't)] make {much sense}, but (it has (a lot ( )of parentheses)) in it.# then the output is This (sentence [doesn't) ERROR ) If the input is This (sentence [doesn't]) make {much sense, but (it has (a lot ( )of parentheses)) in it.# then the output is
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 08/02/2011.

Ask a homework question - tutors are online