Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to build a interactive C shell?

I'm just wondering if this is possible using either (Python, Java or C)? I'm looking for something like IPython for Python.

like image 432
Mino Yarre Avatar asked Sep 23 '10 05:09

Mino Yarre


People also ask

Is shell interactive?

The user can interact with the shell. A shell running a script is always a non-interactive shell. All the same, the script can still access its tty. It is even possible to emulate an interactive shell in a script.

What is interactive mode in shell?

An interactive shell is defined as the shell that simply takes commands as input on tty from the user and acknowledges the output to the user. This shell also reads startup files that occurred during activation and displays a prompt. It also enables job control by default.

How do I start C shell?

When the first argument (argument 0) to the C Shell begins with the -, C Shell starts as a login shell. You can also specify a login shell by invoking csh with the -l option as the only argument. forces a "break" from option processing, causing any further command line arguments to be treated as non-option arguments.

What is the difference between Bash and csh?

CSH is C shell while BASH is Bourne Again shell. 2. C shell and BASH are both Unix and Linux shells. While CSH has its own features, BASH has incorporated the features of other shells including that of CSH with its own features which provides it with more features and makes it the most widely used command processor.


3 Answers

Yes, and such things already exist, you just have to google for them :-)

  • Ch is one popular example
  • CINT is another

That said, actually developing a functional interpreter like this from scratch is much more difficult than finding one online. So now it depends on what's behind your question - do you want just an interpreter to use? Then pick one of the linked above. Do you want to develop such an interpreter? Well, then start reading.

like image 108
Eli Bendersky Avatar answered Sep 26 '22 16:09

Eli Bendersky


GDB, or any other debugger such as the ups debugger, will generally implement a subset of C that can be used interactively.

There is also the Ch C interpreter, a commercial C interpreter, and the open source ccons C interpreter, which is based on clang/LLVM.

like image 44
Brian Campbell Avatar answered Sep 28 '22 16:09

Brian Campbell


c-repl should fit the bill.

like image 43
sigjuice Avatar answered Sep 29 '22 16:09

sigjuice