Contact us - +12567847275

Computer Science Homework Help

Brookhaven College Parentheses Balance Checker Fasm Assembly Language Program

 

Can you help me understand this Computer Science question?


Using the flat assembler (fasm), write a program that reads in a string of various parentheses, brackets, and braces. Output whether or not the parentheses, brackets, and braces are balanced.

The algorithm below can be used to check if parenthesis, brackets, and braces are balanced in an equation.
Balanced input strings: (a) (([{}])) (b) (()[]{[]}) (c) {([]([{({{}})([()])[][]}])[](()){()})}
Unbalanced input strings: (a) )( (b) [(]) (c) (([]{})

Loop – Step through each character (token) of the input string
{
if token is an opening (, [, or {, then push it to the stack.

else if token is a closing ), ], or }, AND the stack is empty, then it’s not balanced (false)

else if token is a ), then pop from the stack. If it isn’t a (, then it’s not balanced (false)

else if token is a ], then pop from the stack. If it isn’t a [, then it’s not balanced (false)

else if token is a }, then pop from the stack. If it isn’t a {, then it’s not balanced (false)
}
if the stack is empty, equation is balanced (true)
else equation is not balanced (false)

Example output
This program checks if the parentheses, brackets, and braces are balanced.
Please enter a string:
(()[]{[]})
This string is balanced.

This program checks if the parentheses, brackets, and braces are balanced.
Please enter a string:
{[])[()]}
This string is not balanced.

{“mode”:”full”,”isActive”:false}

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.