On Thu, Jul 12, 2018 at 11:18 PM, Jim Hall <jh...@freedos.org> wrote:
> This is a tangent, but since
> some
> folks are interested in writing a new BASIC interpreter, I wonder if
> someone is interested in writing a BASIC-like "shell"? Something that uses
> a combination of BASIC and COMMAND.COM syntax would make the interpreter
> a "superset" of COMMAND.COM, and an interesting new shell replacement.
>
> Just an idea.
>
Following this idea a bit:
Use "SET" to assign variables, instead of "LET":
* SET A=4*
* SET DIR=C:\FDOS\BIN*
And "ECHO" to display output instead of "PRINT"
* ECHO Hello world*
And use "%" to reference variables:
* SET A=%A% + 1*
* ECHO %A%*
Or allow "%%" to reference variables, interchangeably: (sloppy, but useful
later)
* SET A=%%A + 1*
* ECHO %%A*
And support extra "IF" constructs so the language can do these:
* IF %VALUE%==1 ECHO True*
* IF NOT %VALUE%==1 ECHO False*
* IF %VALUE%<>1 ECHO False*
* IF %VALUE%>1 ECHO Greater*
* IF %STR%<"ABC" ECHO Less*
And an additional test for files:
* IF EXIST FILE.TXT ECHO Exists*
The "FOR" statement would need to be extended:
* FOR N=1 TO 10 ECHO %N% NEXT N*
Or as a one-line shortcut:
* FOR N=1 TO 10 DO ECHO %N%*
And add a special "IN" syntax with "(..)" to create an iteration:
* FOR %%N IN (1 2 3 4 5 6 7 8 9 10) DO ECHO %%N*
* FOR %%FILE IN (*.TXT) DO ECHO %%F*
(If the language allows "%A%" and "%%A" then DOS batch programs would
probably work seamlessly.)
"GOTO" would use ":" to mark labels like COMMAND.COM:
* SET N=1*
* :LOOP*
* ECHO %N%*
* SET N=%N% + 1*
* IF %N%<10 GOTO LOOP*
And of course, comments remain the same:
* REM This is a comment*
If you called the BASIC-like "shell" using a special parameter (like */P*)
then it would be nice for anything else you specify that isn't recognized
as a shell statement (assuming other syntax is correct) get treated like an
external command. That would make this more like a shell:
* IF EXIST FILE.TXT DEL FILE.TXT*
Also other internal constructs for "CALL" and "ERRORLEVEL" and "SHIFT" and
"PATH" - but you get the idea.
If you can preserve COMMAND.COM syntax and add a BASIC-like programming
language behind it, that would make this an interesting extended shell.
Maybe an idea for an interested developer?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel