Skip to content

Feature request: interactive shell #1

Description

@stangles

Akin to python's interactive shell, allow for users to write and run bf programs in an interactive shell.

Activity

imadhsissou commented on Oct 4, 2016

@imadhsissou

more details please !

stangles commented on Oct 6, 2016

@stangles
OwnerAuthor

I think it would be best to provide an example. Have you used python's interactive shell before? I will show a few examples and then tie that back to this issue.

Python interactive shell examples:

>>> x = 17
>>> x = x + 25
>>> print(x)
42
>>> for n in range(0, 10):
...     print(n)
...
0
1
2
3
4
5
6
7
8
9
>>> def my_print(str):
...     print(str)
...
>>> my_print('interactive shell')
interactive shell
>>>[Ctrl+C]
KeyboardInterrupt
>>>[Ctrl+D]
stangles-MBP:~ stangles$

The above snippet demonstrates a few things:

  1. Variables in scope are preserved across commands. For the bf-interpreter, this would mean preserving "the tape" across input until the interactive shell session is ended.
  2. Multi-line commands (such as function declarations and loops) are handled correctly
  3. An interrupt halts the currently running command but keeps the interpreter running
  4. An EOF input is required to exit the interpreter

These are the important pieces of functionality that I think the interactive shell feature should have. Let me know if you need any more details!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions