Question: 1 Problem descriptiorn Main objective: Determine whether any expression with multiple kinds of brackets, braces and parentheses is balanced using a reference-based stack You must
1 Problem descriptiorn Main objective: Determine whether any expression with multiple kinds of brackets, braces and parentheses is balanced using a reference-based stack You must implement the stack directly yourselves. Using a stack library, or JCF stacks, or a list ADT will earm no credit Types of brackets: TThere are four "parenthesis/bracket" pairs: - (and) - and I and A line may contain other characters (including spaces) besides these & characters, but those characters are ignored. An expression is balanced if all the "open parentheses are closed by a matching"close parentheses, and nested parenthesis match, so that (for example) you can't have "T" closing ". or a stray extra-r when there isn't an open " For example, the following lines are all not valid (N): alpha betaCgamma delta> IITuringl The (quick[brown (fox (jumped)over) the ] lazy ) dog) html And the following lines are all yalid (Y II Turingll) The ( quick brownfox (jumped) over) the ] lazy ) dog html DO> You will wot get any credir if you do not implement your solution to HW msing a roference-based stack Furthermore, you have to write youro stack from scratch You canmor use any bwils-in libraries for stacks or linked sts, nor can you use an ADT for lists or an array-based stack Format: You should provide a Makefike. Running make should create "Balancedja", Your program should take two command line arguments, an input file and an output file Input The input file consists of a series oflines as described above, each (including the last line) ending with an end-of-line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
