Answer the question
In order to leave comments, you need to log in
How to organize an application on the command line according to the principle of the python interpreter?
I want to make an application by the principle of operation similar to the python interpreter. We start the application and it waits for the next command to be entered, after executing it, it waits for the next one and so on until we enter an exit command, for example exit. How to do this? I understand that this requires a huge switch and a loop that will exit only when exit is entered, but I stubbornly can’t figure out how to organize this loop.
Answer the question
In order to leave comments, you need to log in
Try PB grammars. A very good implementation is Parboiled (www.parboiled.org). You will not need a huge switch, and the descriptions of the parsers on Parboiled are perfectly readable.
Still as option, it is possible to smoke sorts of the interpreter, basically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question