I have been assigned with a coding homework in CPP where I'm supposed to create a Matrix calculator.
This would be an ok-ish task considering all I need to do is matrix calculations, use polymorphism, consider memory consumption, and some more criteria.
What I'm struggling with is that is should be a console like environment.
Meaning start the app and I'm in a prompt where I type commands like:
scan x[3][3] \n // this creates new matrix labeled 'x' and waits for 9 ints ( longs possibly ) to by typed.
z = add x y \n // or
z = x + y \n
I am familiar with automata theory ( to some degree ) and making it this simple shouldn't be a problem. ( that practically has nothing to do with automata ) Simple meaning one command per line - because that's what I'm doing now. I have some parser class that breaks down the command, and than I do the necessary changes. Its more of a if-else tree going from first word to the last. If I encounter unrecognized word - Grammar/Syntax error.
What I'm asking is some tips on how to make it more .. bash like, for instance.
Since the app is run in bash..
FIRST Q: how do i achieve a history of typed commands ? rn when i push arrowup i get those ^[[A.
SECOND Q: Some hints how start parsing some more complicated commands like: a = b = c * ( d + q ) ( implying that 'c' can multiply "(d + q)" and 'd' is addable to 'q' etc.. ) bcs that cant be done with the static way my parser works rn.
Thank you all.