T
T
Tarasov Konstantin2014-04-27 20:04:03
Java
Tarasov Konstantin, 2014-04-27 20:04:03

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

3 answer(s)
M
mrstrictly, 2014-04-27
@saroff

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.

S
slaykovsky, 2014-04-27
@slaykovsky

Here you can take a look.

S
slaykovsky, 2014-04-27
@slaykovsky

Still as option, it is possible to smoke sorts of the interpreter, basically.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question