BASIC Interpreter example source
Author |
Message |
Ed Par #1 / 25
|
 BASIC Interpreter example source
Hi Guys! Anyone interested in a starting BASIC interpreter? I've been around a while, and came across this one recently while looking into a C cpackage called Micro C by Dave Dunfield. Micro C is along the lines of BASM286 and Moonrock BASIC - ie: it put's out assembly code and then requires that YOUR assembler and linker do the final assemble and link to get eithr a COM or EXE (Small model) file. It is more hands off than either BASM or Moonrock however. Makes some nice tight & small COM/EXE's to boot! Anyway, for one of it;s examples it has a decent little BASIC interpreter written in Micro C syntax (90% standard C syntax). I found it very interesting as an interpreter example. Other exampels include a terminal and assembler (in Micro C). If interested - www.dunfield.com for the latest version, or hit SIMTEL's C directory. Ep Ed Parry - Southern California, USA
Unauthorized amphibians will be toad away.
|
Fri, 10 Sep 1999 03:00:00 GMT |
|
 |
Pytr Klar #2 / 25
|
 BASIC Interpreter example source
Quote: > Anyone interested in a starting BASIC interpreter?
Group project, or individually? This would be one group project that I'd be interested in helping out with, so long as others are interested (and dedicated!) Have you thought of any additional functions yet? Brainstorm; add to the list: o built in .PCX/.BMP support o built in pull-down menu support (with lightbars, of course) o ModeX support o file directory box (would make life all the more easier) o simple bit handling operations o built in mouse support o extended graphics: ellipses, arcs, etc. o support for com3/com4 o flexible array handling: add, delete, etc. Well, that's a list (in no particular order) of bonuses I would like to see in an interpreter, and it is by no means complete. I'm sure I'll think of some more things, but that list was off the top of my head. Wow! Now I'm really fired up about this! Peter
|
Fri, 10 Sep 1999 03:00:00 GMT |
|
 |
Terence Jord #3 / 25
|
 BASIC Interpreter example source
Quote: >If interested - www.dunfield.com for the latest version, or hit SIMTEL's C >directory.
Can someone give me a direct URL to this, please? Also, has anyone thought of using The Artful Parser's EVALUATE.BAS program for variable storage? Can we build XMS support in here? I'm sure we can use Rick's routine at www.qbasic.com...! Lator gaters, +--Terence Jordan(x7233)----------------+----------------------------+
|(parenthesis) | Or in doubt, | | |---------------------------------------| Run in circles, _/ \ | |Views expressed are Terence's | Scream and shout!" / | +-----and of no other.------------------|----------------------------+
|
Sat, 11 Sep 1999 03:00:00 GMT |
|
 |
rick #4 / 25
|
 BASIC Interpreter example source
Quote:
>>Hi Guys! >>Anyone interested in a starting BASIC interpreter? >I'll throw my hat into the ring. >I've often wondered why someone hasn't developed an user >modifiable language. A language that would allow the user to add >functionality as an integral part of the language. >The essences of any higher level language is the executions of >functions. The value of any higher level language is it's ease >of use and it's hugeness of functionality. A higher level >language dies out if it can't put out. >Why not make the language so the user can add functionality? The >package would an easy to use IDE and a user modifiable function >library. If you wrote IDE/LIB without mouse functions, then I >could write and add them to the language in such a way that they >would be an integral part of the language. I would then submit >my mouse functions to the committee and they would do their >committee thing. To not only provide a better mouse trap, but to >also provide the means to improve upon the mouse trap. >All of us have wish lists, mine is singular, a language that >will not die. >With that said, let the committee begin.
He Richard! Very good, if I understood you well then youre 'user modifiable language' closely resembles what I said to make some frame/container fast and let everyone put there desires into it ;). Using the word 'user modifiable language' has a lot of appeal though! But you are not meaning the 'end-user' I guess ? I repeat my desire for Ep to take up some decisions fast: what would be the language to program in, will he be the committee( or at least the dir ?), what will be desired to make the frame/container and who will start with that. If we are really gonna do something like this( I like to think of it as something like the OSdevil thing or the JOLT thing under way. Of course more at our levels(g). Ep you might contact Jan Zumwalt about how to direct such a thing if you are uncertain..). Also I could make contact to two really great BASIC guru's who are not into usenet, but might be willing to help us( yes Dan is one of them). My proposition is asm for the language( all basic routines are already there in STDLIB, or FREELIB, etc etc), and TASM 2.0 for the compiler ( its .386+ and you can get it with HOTBOT! go for it) But I repeat myself: lets get started fast! Before we have a no_code threat like GIU! Rick Lets get some minimal thing: 1) Editor: support for multiple windoze for subs/functions can be postponed( see below). qs:Linelength(256), linedelimiter(crlf?), filelength( unlimited ?) There is for instance source for some older version of notepad available which could be a good starting point. Later we only have to add multiple windoze..Scrolling etc is already there, unlimited filelength too. qs:functions(like QBASIC ?), keyhandling procedure, mouse support( lets not waste energy there at first..) 2)Intrepreter: START: what will be the signs for COMMENTS : (' ?) METACOMMANDS: (# ?) add a metacommand for DATASPACE allocation CODE ( nothing ?) CODEPARTS( FUNCTION/ SUB ?) DECLARATIONS: ((RE)DIM for variables, DECLARE for FUNCTIONS/SUBS ?) 2: DATASPACE: Q: XMS or FLAT SUPPORT ? ( Flat needs XMS lock to) PREALLOCATED XMS ON METACOMMAND LENGTH(64 kB LOW + RAM CONNECTION for more ?) STORAGE: 2/4 BYTE DESCRIPTOR: CONTENT LIKE DD: XMSOFFSET& 4:DB* 512: LOWBUFFER FOR SWAP LOW/XMS ELSE DW: VARIABLE LENGTH= 0..&HFFFF 2:DB*LENGTH: The intrepreter must decide at runtime how to intrepret the DATA( as ramtype,byte integer, integer, string etc..etc.) For array's something like: DIM RAMDIM For variables something like: %,&,#,$,! only problem there: RAMSTRING: could be something like $$ The rest for DATA is a parsing routine and a case routine. 3: STACK LENGTH(?) SEE POINT 6 TOO.. 4. CODE PRESETTED SEGMENT REGISTERS TO 4gb FLATMODE At this moment we really need flatmode!(routines available) -Since it will not be pmode intrepreter I guess we have 16 bit code ,but we will use .386 code in a 32 bit segment. -So we have to check for *.386 cpu( routine available), and for dosbox( routine available) 1-The intrepreter puts the intrepreted code into our XMS locked -segment available from real mode. 2-We do a far jump to the code and hopla: it gets executed.. -We need to unlock and deallocate XMS 5: COMMANDS Lets start with some easy things( all available everywhere) This is not the most difficult part! 6. SUB/FUNCTION SUPPORT But this is! Later we might start with making a real intrepreter which supports subs/functions. Crucial for the lucidity of the intrepreter might be the way to pass arguments. Normally this is done with some internal buffer/stack, which becomes invisible for the end_user. Also the way to define variables local., global needs careful consideration. Thats another arrea where most intrepreters get invisible. A. PRIORITIES: Since commands are basically available and easy, and the same holds for the XMS/FLATMODE support that routines do only need some minor adjustments. I would strongly suggest that first we make a suitable minimal editor WITH keyhandling support. At the same time we could start discussing DATA issues, so that when the coding of the editor is fini, we can start with the much more difficult DATA parts. At that time we can split up so that a few will make the DATA part, others will do some COMMAND parts, while all can start discussing SUB/FUNCTION issues.
I am afraid that Gunnar might not agree, but I think we have a chance if we make/ maintain it for free with a group of programmers, and do not set time limits. Just some goodie.
|
Sat, 11 Sep 1999 03:00:00 GMT |
|
 |
Richard S. Emers #5 / 25
|
 BASIC Interpreter example source
Quote:
>Hi Guys! >Anyone interested in a starting BASIC interpreter?
I'll throw my hat into the ring. I've often wondered why someone hasn't developed an user modifiable language. A language that would allow the user to add functionality as an integral part of the language. The essences of any higher level language is the executions of functions. The value of any higher level language is it's ease of use and it's hugeness of functionality. A higher level language dies out if it can't put out. Why not make the language so the user can add functionality? The package would an easy to use IDE and a user modifiable function library. If you wrote IDE/LIB without mouse functions, then I could write and add them to the language in such a way that they would be an integral part of the language. I would then submit my mouse functions to the committee and they would do their committee thing. To not only provide a better mouse trap, but to also provide the means to improve upon the mouse trap. All of us have wish lists, mine is singular, a language that will not die. With that said, let the committee begin.
|
Sun, 12 Sep 1999 03:00:00 GMT |
|
 |
Gunnar Beushause #6 / 25
|
 BASIC Interpreter example source
Quote: > I've often wondered why someone hasn't developed an user > modifiable language. A language that would allow the user to add > functionality as an integral part of the language. > All of us have wish lists, mine is singular, a language that > will not die.
That sounds really good. But how do you want to do that? In wich language do you want to write it? Have you ever written a compiler? This is really hard work, if you want to have an example how someone shouldn't write an interpreter take a look at the old ALPHA version of GBasic. --- Gunnar Beushausen
http://www.hof.de/~gbasic
|
Sun, 12 Sep 1999 03:00:00 GMT |
|
 |
Tom Lak #7 / 25
|
 BASIC Interpreter example source
Quote:
> >>Hi Guys! > >>Anyone interested in a starting BASIC interpreter? > >I'll throw my hat into the ring. > >I've often wondered why someone hasn't developed an user > >modifiable language. A language that would allow the user to add > >functionality as an integral part of the language.
<<mega-snip>> Ever heard of Forth? It allows you to add keywords at will. Even QB, PDS and VBDOS allow you to create libraries of functions and subprograms that you can use like extensions to the language. I created a series of MAT subs that are called like so: DIM A(10) MAT READ A MAT PRINT A DATA 4,1,6,7,9,1,0,3,2,5 See? It looks like a part of the language when you call the SUB named MAT. There ARE limitations, to be sure (the most annoying is that you can't have a variable number of arguments unless you pass a string and parse it yourself: y = MULT("3,5,8") would set y equal to 120 and y = MULT("7,4") would set y equal to 28 Tom Lake
|
Mon, 13 Sep 1999 03:00:00 GMT |
|
 |
Steve Ru #8 / 25
|
 BASIC Interpreter example source
Quote:
>Hi Guys! >Anyone interested in a starting BASIC interpreter?
Quote: >I've often wondered why someone hasn't developed an user modifiable
language. >A language that would allow the user to add functionality as an integral part Quote: >of the language. ----< snip >---- >The package would an easy to use IDE and a user modifiable function
library. Any language implementation that allows seperate compilation can be extended. Functions that are awkward to write in the target language can be implemented in assembly language and linked. The QuickBasic IDE has an easy way to load user-defined libraries, which don't have to be written in QuickBasic. Forth is a small language in which you define 'words' which you use to define more complex words, until you define the name of your application. Forth is usually implemented as a threaded-code interpreter. This gets amazing performance from a tiny system; the Forth "inner interpreter" for CP/M was just six{*filter*} bytes of 8080 code. That's not a typo. Bytes, not kilobytes. Of course, the editor/compiler was bigger, but that did not have to be present at runtime. All this bang-per-buck has a price: the programmer must do much of the work normally done by a compiler's front end, such as managing the runtime stack and converting expressions to reverse Polish notation. There was also a series of articles in Byte by Jhonathan Amsterdam, some years ago, on compiler construction. They included C code for several compiler parts, plus a stack-oriented virtual machine similar to the "hypothetical stack machine" mentioned in the Pascal report. Does anyone remember this series? My Byte collection was destroyed by a flood.
|
Mon, 13 Sep 1999 03:00:00 GMT |
|
 |
r.. #9 / 25
|
 BASIC Interpreter example source
First, one of my web pages has pointers to source code for about a dozen Basic interpreters: <http://www.nicholson.com/rhn/basic/>
Quote: >I've often wondered why someone hasn't developed an user >modifiable language. A language that would allow the user to add >functionality as an integral part of the language.
Most modern languages already have this to some degree. C, Pascal, fortran, Modula, etc. allow you to add functions; C++, Smalltalk, Java, etc. allow you to add objects and data types; Even VB4 seems to be evolving in this direction. C++ allows you to add functionality to some of the operators. Lisp, Scheme, Forth, etc. allow you to add new keywords and syntax. Forth and Lisp were designed to be easily extended by the not only the programmer, but even the user. You can even create a different looking language from assembly language or C just by clever use of the macro preprocessor. ---
#include <canonical.disclaimer> // only my own opinions, etc.
|
Tue, 14 Sep 1999 03:00:00 GMT |
|
 |
Richard S. Emers #10 / 25
|
 BASIC Interpreter example source
Quote:
>First, one of my web pages has pointers to source code for about a >dozen Basic interpreters: <http://www.nicholson.com/rhn/basic/>
Thank you for the pointers. You have a very good Web Site. Which Basic interpreter is closest to MS QBASIC? Quote: >Most modern languages already have this to some degree.
Yes, but not to the degree I desire. Take MOUSE functions and QBASIC. One can write the routines or find the routines, either way one has to manually include these routines into each program. If I could catalog these routines back into QBASIC then it would appear that QBASIC already had these routines. Add the ability to update the HELP file and QBASIC now has MOUSE functionality as an integral part of its self. Quote: (snip) >You can even create a different looking language from assembly language >or C just by clever use of the macro preprocessor.
Yes, I did this. Called it BIG.MAC. Then a friend said, "Why don't you just use BASIC and call the #$% routines?" So that's what I do now, but it'd be nice to catalog the routines back into QBASIC.
|
Wed, 15 Sep 1999 03:00:00 GMT |
|
 |
Kenneth Lantr #11 / 25
|
 BASIC Interpreter example source
As a professional in the fields of computer programming and administering, I would like to voice my opinion on this matter. I don't mind if the program is interpreted or compiled as long as it can access databases that are already considered standard. SQL, DBase, MDB... For me, MDB is the most important. These programs must also be multi-user accessible. I occasionally read these newsgroups for any usable information that I might be able to apply to real life circumstances. I've found that we have an enormous amount of talent in this group and others as well. Unfortunately, most of this talent doesn't seem to know how to apply it to a useful means. There are many problems that need solving in today's business world. Individually we know how to make something. Software is getting more complex every day. To stay in the paying market we may need to start pooling our talents to a greater project. We need project leaders with real solutions to real problems. One such problem that I am about to undertake (if things don't straighten out on their own) is a general purpose program that will allow writers (books and articles) to sell their works over electronic methods. Writers have this problem of getting books published without getting ripped off. They are in the business of selling information. It just so happens that information is more difficult to peddle, than ICE in alaska! Novels are created on computers around the globe, then sent to publishers for manufacturing and distribution. It sure would be nice if there were a way for authors to be able to sell their works directly (uploading over the internet) and be able to ensure payment for their works. Of course, books still need to be printed for those computer deficient people in our society. None the less, it would allow unknown authors to become known authors. ____________________________________ PGP Key=3E634CB9 FP=6F4F3A5D52519646 3BD400A368158C8F
http://cust2.iamerica.net/kdl1 PGP key available at web page too!
|
Wed, 15 Sep 1999 03:00:00 GMT |
|
 |
Brad Rathbu #12 / 25
|
 BASIC Interpreter example source
This is a multi-part message in MIME format. ------=_NextPart_000_01BC3C10.E424EDE0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Quote: > Hi Guys! > Anyone interested in a starting BASIC interpreter? I've been around a
while, I'd be interested, depending on how much C we would be using. I am about as close to useless as you can get using C! Don't know it, don't want to..... Brad ------=_NextPart_000_01BC3C10.E424EDE0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 = color=3D"#000000" face=3D"Arial"><br><br><br><br>Ed Parry <<font =
wrote in article <<font =
color=3D"#000000">>...<br>> Hi Guys!<br>> <br>> Anyone = interested in a starting BASIC interpreter? I've been around a = while,<br><br><br>I'd be interested, depending on how much C we would be = using. I am about as close to useless as you can get using C! Don't know = it, don't want to.....<br><br>Brad</p> </font></font></font></font></font></body></html> ------=_NextPart_000_01BC3C10.E424EDE0--
|
Wed, 15 Sep 1999 03:00:00 GMT |
|
 |
Brad Rathbu #13 / 25
|
 BASIC Interpreter example source
This is a multi-part message in MIME format. ------=_NextPart_000_01BC3C12.1E76A0A0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Quote: > That sounds really good. But how do you want to do that? In wich language > do you want to write it?
Well, not to {*filter*}in ..... I'd like to write it using QuickBASIC for the first version and then use the resultant compiler to build upon itself. That way, I can start with something I know and build upon it. Seems to me the ability to add functions and subs is a great idea and one worth continuing, but it would be nice to be able to do the same thing and make it a permanent (or at least semi-permanent) part of the language. Quote: > Have you ever written a compiler? This is really hard work, if you want to > have an example how someone shouldn't write an interpreter take a look at > the old ALPHA version of GBasic.
I've never written one, but would like to. Have you ever written one? I'd sure like to have a look at the Alpha version of GBasic. Got it? Brad ------=_NextPart_000_01BC3C12.1E76A0A0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 = color=3D"#000000" face=3D"Arial"><br><br><br><br>Gunnar Beushausen =
color=3D"#000000">> wrote in article <<font =
color=3D"#000000">>...<br>> That sounds really good. But how do = you want to do that? In wich language<br>> do you want to write = it?<br><br>Well, not to {*filter*}in ..... <br>I'd like to write = it using QuickBASIC for the first version and then use the resultant = compiler to build upon itself. That way, I can start with something I = know and build upon it. Seems to me the ability to add functions and = subs is a great idea and one worth continuing, but it would be nice to = be able to do the same thing and make it a permanent (or at least = semi-permanent) part of the language.<br><br>> <br>> Have you ever = written a compiler? This is really hard work, if you want to<br>> = have an example how someone shouldn't write an interpreter take a look = at<br>> the old ALPHA version of GBasic.<br>> <br><br>I've never = written one, but would like to. Have you ever written one? I'd sure like = to have a look at the Alpha version of GBasic. Got it? <br><br>Brad</p> </font></font></font></font></font></body></html> ------=_NextPart_000_01BC3C12.1E76A0A0--
|
Wed, 15 Sep 1999 03:00:00 GMT |
|
 |
Richard S. Emers #14 / 25
|
 BASIC Interpreter example source
Quote: >As a professional in the fields of computer programming >and administering, I would like to voice my opinion on >this matter. I don't mind if the program is interpreted >or compiled as long as it can access databases that are >already considered standard. SQL, DBase, MDB... For >me, MDB is the most important. These programs must also >be multi-user accessible.
Multi-user is easy, but different databases would be hard. It'd be like having to interface with different word-processor, It'd be a lot harder on the programmer than the program. Besides, do you know the difference between SQL and a DOOR-KNOB? There's not much. The reason there's so many databases is the same reason there's so many different languages. The end-programmer couldn't improve upon it or was told not to improve on it because these improvements would be NON-STANDARD. -AND- before I get flamed again. I agree, MASM, C, Forth, etc. allow the programmer to enhance, but... (snip) Quote: >We need project leaders with real solutions to real problems.
Ok, you can be the leader, but no Comet{*filter*}tails! (snip) Quote: >None the less, it would allow unknown authors to become known >authors.
You'll never make it Ken, you're not consistent. Look at your opening statement, "As a professional...". So you expect me to give credence to your utterances because your are a professional. OK, then why should I read an unknown author?. Duh? If you're going to be a leader Ken, you need to be consistent. P.S. Will you be supplying the uniforms? Can we do something besides black? How about sea-foam and salmon? Those are up-beat colors. P.P.S I don't look good in purple. P.P.P.S. I'm suprised a professonal would be interested in my cause, it is NON-STANDARD.
|
Wed, 15 Sep 1999 03:00:00 GMT |
|
|
Page 1 of 2
|
[ 25 post ] |
|
Go to page:
[1]
[2] |
|