Timu5 / BasicSharp

BASIC interpreter in C#
MIT License
86 stars 20 forks source link

Is it possible to single step the basic code? #3

Open mercurial-moon opened 1 year ago

mercurial-moon commented 1 year ago

HI, Thanks for the wonderful contribution. Is there a mechanism to single step the basic code, if not can you please let me know would it be simple to create such a feature?

Timu5 commented 1 year ago

Hey, sorry for long time without respond.

Code dont allow it but can be modified to do so.

in interpreter.cs there is this code:

        public void Exec()
        {
            exit = false;
            GetNextToken();
            while (!exit) Line(); // do all lines
        }

You can add two new method lets say Init() and Step():

        public void Init()
        {
            exit = false;
            GetNextToken();
        }
        public void Step()
        {
            if(!exit) Line(); 
        }
mercurial-moon commented 1 year ago

Thanks for the response! Really appreciate it!