BASIC Developer & Support Resources > Interpreters

MY-BASIC

(1/42) > >>

John:
I have compiled MY-BASIC for Windows (VS2008), Ubuntu 32/64 bit (gcc) and Android Linux (gcc). I view MY-BASIC as a SB-LITE like BASIC that is portable, extensible and embeddable. I modified it a bit and changed the ] prompt to be > with a space after it. I also took the startup info and made it part of the help screen. On startup of the shell, it displays MY-BASIC and the version number before dropping to the prompt. I optimized and stripped the Linux versions. The final executable sized range from 102 KB to 56 KB depending on the platform. The following is what MY-BASIC doesn't have that ScriptBasic does.

[*]SUB/FUNCTION support
[*]File support
[*]Socket support
[*]System calls
[*]External library support
[/list]

If all you're looking for is a simple to use embeddable BASIC, MY-BASIC is very well done and fast for being an interpreter. I see MY-BASIC as a great foundation for someone that wants to create there own BASIC but doesn't have the skills to start from scratch. MY-BASIC would be a good teaching tool for kids to learn BASIC programming.

Windows XP


Android Linux


Ubuntu Linux



John:
Hi Tony,

Just noticed your post on the BP.org site. I have been playing with your BASIC for a couple of years. I even have it running native on Android. I had posted the info I had here on All BASIC on BP.org but there seemed to be very little interest.

I'm not surprised as the Bitter BASIC Boys (and their toys) spend most of their time feeling miserable and pissed off their attempts at creating a BASIC of their own wasn't as easy as they anticipated. Their way to deal with it is to trash those that have made the commitment to do it right. Sad really.

John

John:
I was able to compile the new release on Linux 64 bit.


jrs@laptop:~/mybasic/my_basic-master$ ./mybasic
MY-BASIC Interpreter Shell - 1.0.0050.
Copyright (C) 2011 - 2015 W. Renxin. All Rights Reserved.
For more information, see https://github.com/paladin-t/my_basic/.
Input HELP and hint enter to view help information.
]HELP
Commands:
  CLS   - Clear screen
  NEW   - Clear current program
  RUN   - Run current program
  BYE   - Quit interpreter
  LIST  - List current program
          Usage: LIST [l [n]], l is start line number, n is line count
  EDIT  - Edit a line in current program
          Usage: EDIT n, n is line number
  LOAD  - Load a file as current program
          Usage: LOAD *.*
  SAVE  - Save current program to a file
          Usage: SAVE *.*
  KILL  - Delete a file
          Usage: KILL *.*
]BYE
jrs@laptop:~/mybasic/my_basic-master$

John:
Markus (Cybermonkey),

You must have been reading My_Mind. I have compiled MY-BASIC on all major platforms and wanted to create a Script BASIC extension module embedding My_Basic. It might make a nice addition to the TinyScheme and  Perl extension modules I did. The nice aspect of all three of the language extensions is they are interpretive and typeless. (like Script BASIC the host)

I'm slammed with a project at the moment but when I have some free time I'll take a shot of creating the Script BASIC MY-BASIC extension module using C BASIC.

John:
I put together a quick extension module for MY-BASIC and seem to have a problem passing a string.  ???

interface.c

--- Code: C ---// MY-BASIC - Script BASIC extension module #include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <ctype.h>#include <math.h>#include <time.h>#include "../../basext.h"#include "cbasic.h" #include "my_basic.h"  /**************************** Extension Module Functions****************************/ besVERSION_NEGOTIATE  RETURN_FUNCTION((int)INTERFACE_VERSION);besEND besSUB_START  DIM AS long PTR p;  besMODULEPOINTER = besALLOC(sizeof(long));  IF (besMODULEPOINTER EQ NULL) THEN_DO RETURN_FUNCTION(0);  p = (long PTR)besMODULEPOINTER;  RETURN_FUNCTION(0);besEND besSUB_FINISH  DIM AS long PTR p;  p = (long PTR)besMODULEPOINTER;  IF (p EQ NULL) THEN_DO RETURN_FUNCTION(0);  RETURN_FUNCTION(0);besEND  /******************** MY-BASIC Functions********************/ struct mb_interpreter_t* bas = 0; besFUNCTION(mbas_init)  DIM AS int rtnval;  rtnval = mb_init();  besRETURN_LONG(rtnval);besEND besFUNCTION(mbas_dispose)  DIM AS int rtnval;  rtnval = mb_dispose();  besRETURN_LONG(rtnval);besEND besFUNCTION(mbas_open)  DIM AS int rtnval;  rtnval = mb_open(AT bas);  besRETURN_LONG(rtnval);besEND besFUNCTION(mbas_close)  DIM AS int rtnval;  rtnval = mb_close(AT bas);  besRETURN_LONG(rtnval);besEND besFUNCTION(mbas_load_str)  DIM AS const char PTR pgm;  DIM AS int rtnval;    besARGUMENTS("z")    AT pgm  besARGEND  rtnval = mb_load_string(AT bas, pgm);  besRETURN_LONG(rtnval);besEND  besFUNCTION(mbas_run)  DIM AS int rtnval;  rtnval = mb_run(AT bas);  besRETURN_LONG(rtnval);besEND 
testmb.sb

--- Code: Script BASIC ---DECLARE SUB mb_init ALIAS "mbas_init" LIB "mb"DECLARE SUB mb_dispose ALIAS "mbas_dispose" LIB "mb"DECLARE SUB mb_open ALIAS "mbas_open" LIB "mb"DECLARE SUB mb_close ALIAS "mbas_close" LIB "mb"DECLARE SUB mb_load_str ALIAS "mbas_load_str" LIB "mb"DECLARE SUB mb_run ALIAS "mbas_run" LIB "mb" mb_initmb_openmb_load_str("10 PRINT \"Hello MY-BASIC\"")mb_runmb_closemb_dispose 
Output

jrs@laptop:~/sb/sb22/mybasic$ scriba testmb.sb
scriba: my_basic.c:3736: mb_load_string: Assertion `s && s->parsing_context' failed.
Aborted (core dumped)
jrs@laptop:~/sb/sb22/mybasic$

Navigation

[0] Message Index

[#] Next page

Go to full version