“Why at this point in token_make_operator_or_string do we need to understand if...

claudio daffra Answered 1 answer
Question by claudio daffra 2 years ago

Question

“Why at this point in token_make_operator_or_string do we need to understand if there is a parenthesis and insert it into the counter and in lex_new_expression we need to save the expression in paretheses_buffer, is it necessary for the preprocessor? In all cases, if the token is a parenthesis ‘(’ in the vector of tokens, is this operator ‘(’ returned?”

Answers

Answered by Daniel McCarthy

Instructor

We create the buffer as a way of storing information so when there is a syntax error we will be able to output the current parantheses buffer if needed. By the end of the course I believe we dont use it, but its a very handy tool to have when debugging with GDB so I recommend implementing it as shown