Comment on A Brutal Look at Balanced Parentheses, Computing Machines, and Pushdown AutomataparentComments−testaccount289moyou don't need a full counter. increment, decrement, and check_if_zero are enough. no need for get_value.−stellalo9moyou also need check_if_negative to detect close-before-open−jibal9moThe counter is at 0, which indicates an error ... that plus the counter being non-zero when reaching the end of input is the entire point.
Comments
you don't need a full counter. increment, decrement, and check_if_zero are enough. no need for get_value.
you also need check_if_negative to detect close-before-open
The counter is at 0, which indicates an error ... that plus the counter being non-zero when reaching the end of input is the entire point.