Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:08:35+00:00 2026-06-10T20:08:35+00:00

I have an application; to interact with it I have to develop an interactive

  • 0

I have an application; to interact with it I have to develop an interactive shell. The shell will take input from user and dispatch it to the server, which will process and return a response.

In the past I have done such things, but they typically had the following format:

Shell>> COMMAND arg1 arg2 arg3 ..

and my implementation was in a manner similiar to:

/* Mock implementation */
while(true) {
   in = readline()
   tokens = in.split(' ') //split based on space
   switch(token[0])  {
      case "Command_a": processA(token[1], token[2])
      case "Command_b": processB(token[1], token[2], token[3])
   }
}

This time I have to work with more extensive grammar for user input. If I use my current approach, it will make things very difficult with lots of if , if-elseif-else, if-else, switch statements for both parsing and generating response.

How can I approach this problem in a manner that will make the interpreter modular and maintainable? What are some ways in which popular CLI-Interface are implemented? I will really appreciate some code examples.

PS: Language choices limited C++/Python

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:08:37+00:00Added an answer on June 10, 2026 at 8:08 pm

    You can develop your own parser and interpreter using bison and flex, but probably wiser is to embed an existing interpreter like Python, Lua or Squirrel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an console application which interact another user interface. Interface sends commands and
I have a SharePoint server. I am building an rails application which can interact
We have an application which needs to interact with 3 different databases (SQL Server)
I have an application in which users interact with each-other. I want to visualize
I have a web application build in Django + Python that interact with web
I have a DESKTOP application which interacts with a web service through their RESTful
I have a Java application which interacts with native code using JNI. The native
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have application which needs to use a dll (also written by me) which
I am planning to develop a file transfer application. I have a file transfer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.