1. BASIC-to-Euphoria - some inquiries
- Posted by jzeitlin at cyburban.com Mar 18, 2002
- 385 views
I'm currently working on converting some old BASIC code - mixed GW-BASIC and Q-BASIC - to Euphoria. While investigating available tools, the following questions have arisen: (1) For David Cuny: The ebasic translator indicates that you've effectively abandoned it, and you note in one of the readmes that were you starting the project today, you'd take a different tack in the design. Unless you plan to resurrect the project, I'm going to have to write a translator of my own, as ebasic, even when presented with what I've been calling a 'Euphoria-clean' file, has some deficiencies in the generated code, and lacks some support for some BASIC features. Given that, I'd be interested in hearing what you have to say about the revised approach - or hearing that you _haven't_ abandoned ebasic, and are on the verge of releasing an update. (2) Graphics: At last report, there were no Euphoria includes that would provide a simple interface to graphics across all extant supported platforms. If someone knows of one that does - and by 'simple', I mean at the DOS graphics.e level, or perhaps implementing something similar to the GW-BASIC/Q-BASIC graphics interface. If anyone can point me in an appropriate direction, I'd be appreciative. (3) An alternative to writing my own translator would be to use a tool that could take structured definitions of the two languages, and be able to convert one to the other. I _know_ that such tools exist, primarily for UNIX platforms (including Linux), but enough are available in source form that I could easily compile one for DOS. What I need for those tools, though, is good definitions of the languages in question - meaning, usually, either EBNF notation definitions, or 'railroad track' diagrams of the language syntax. I'm pretty sure I can find definitions for GW-BASIC/Q-BASIC; has anyone done one for Euphoria? -- Jeff Zeitlin jzeitlin at cyburban.com
2. Re: BASIC-to-Euphoria - some inquiries
- Posted by David Cuny <dcuny at LANSET.COM> Mar 18, 2002
- 380 views
Jeff wrote: > I'd be interested in hearing what you have to say about the revised > approach - or hearing that you _haven't_ abandoned ebasic, and > are on the verge of releasing an update. I've continued not to work on eBasic. I have written a BASIC interpreter called wxBasic, but it's coded in C, not Euphoria. Most BASIC functions can be emulated in Euphoria. If I recall, EBASIC.E contains quite a few of them. The bits that are more problematic are: - GOTO - GOSUB - pass by reference - FOR loops altering indexes Were I to do it again, I don't think I'd bother with a QBasic->Euphoria translator. There are just too many dissimilarities between the languages. It would be more sensible to write a virtual machine to run the QBasic code. Barring that, I'd grab the patched version of Euphoria, by Karl Bochert. It already supports GOTO and pass by reference. You can convert QBasic FOR loops to Euphoria while loops. For GOSUB, if you ask Karl nicely, he might add it to his version of Euphoria. In terms of doing this with an unpatched version of Euphoria: it can be done, but the results won't be what you wanted. -- David Cuny
3. Re: BASIC-to-Euphoria - some inquiries
- Posted by kbochert at ix.netcom.com Mar 18, 2002
- 367 views
-------Phoenix-Boundary-07081998- Hi David Cuny, you wrote on 3/18/02 8:34:48 AM: >Barring that, I'd grab the patched version of Euphoria, by >Karl Bochert. It already supports GOTO and pass by reference. Unfortunately, the PBR was a quick hack which only worked when only the members of a sequence were modified. A 'full-up' version is much more complicated. >For GOSUB, if you ask Karl nicely, he might add >it to his version of Euphoria. ALways looking for simple enhancements. How is GOSUB different from a function or procedure call? Karl Bochert -------Phoenix-Boundary-07081998---
4. Re: BASIC-to-Euphoria - some inquiries
- Posted by "Carl R. White" <euphoria at carlw.legend.uk.com> Mar 18, 2002
- 366 views
Karl Bochert wrote: > ALways looking for simple enhancements. How is GOSUB > different from a function or procedure call? The following BASIC code is an example (of course, there are better things that can be done with this technique): 10 print "He"; : gosub 50 20 print "o Wor"; : gosub 60 30 print "d!" 40 end 50 print "l"; 60 print "l"; 70 return i.e. you can GOSUB mid subroutine. Carl PS I still don't advocate this kind of thing in high level programming, but in machine code and C64 BASIC it can be invaluable. ;)
5. Re: BASIC-to-Euphoria - some inquiries
- Posted by David Cuny <dcuny at LANSET.COM> Mar 18, 2002
- 362 views
Karl Bochert wrote: > ALways looking for simple enhancements. How is GOSUB > different from a function or procedure call? A GOSUB pushes the address it came from on the return stack, and then jumps. When it reaches a RETURN, it returns to the next instruction. Unlike function calls: - It goes to a label - It keeps the same scope - It doesn't pass parameters -- David Cuny
6. Re: BASIC-to-Euphoria - some inquiries
- Posted by kbochert at ix.netcom.com Mar 18, 2002
- 381 views
-------Phoenix-Boundary-07081998- Hi David Cuny, you wrote on 3/18/02 11:08:48 PM: >A GOSUB pushes the address it came from on the return stack, and then >jumps.. >When it reaches a RETURN, it returns to the next instruction. Unlike >function >calls: > > - It goes to a label > - It keeps the same scope > - It doesn't pass parameters > >-- David Cuny > Sounds trivial, seeing as how I already have goto. Karl Bochert -------Phoenix-Boundary-07081998---
7. Re: BASIC-to-Euphoria - some inquiries
- Posted by Kat <gertie at PELL.NET> Mar 19, 2002
- 379 views
On 18 Mar 2002, at 23:30, kbochert at ix.netcom.com wrote: > > Hi David Cuny, you wrote on 3/18/02 11:08:48 PM: > > >A GOSUB pushes the address it came from on the return stack, and then > >jumps.. > >When it reaches a RETURN, it returns to the next instruction. Unlike > >function > >calls: > > > > - It goes to a label > > - It keeps the same scope > > - It doesn't pass parameters > > > >-- David Cuny > > > > Sounds trivial, seeing as how I already have goto. It is, but since we have functions and procedures, we don't need the gosub, except as something which disregards the returns, if any. The Basic gosub translation to Eu might be difficult, given the scope of the function is the same as the calling code block. I have arguements for and against sharing scope with gosubs, but i have made good use of nesting procedures and functions inside other procedures and functions, to share scope of non-global vars. This is generally easily solved in Eu with included files though. Kat
8. Re: BASIC-to-Euphoria - some inquiries
- Posted by kbochert at ix.netcom.com Mar 19, 2002
- 385 views
-------Phoenix-Boundary-07081998- Hi Kat, you wrote on 3/19/02 1:09:45 AM: > >On 18 Mar 2002, at 23:30, kbochert at ix.netcom.com wrote: > > > Hi David Cuny, you wrote on 3/18/02 11:08:48 PM: > > Sounds trivial, seeing as how I already have goto. > >It is, but since we have functions and procedures, we don't need the >gosub, >except as something which disregards the returns, if any. The Basic gosub >translation to Eu might be difficult, given the scope of the function is >the >same as the calling code block. I have arguements for and against sharing >scope with gosubs, but i have made good use of nesting procedures and >functions inside other procedures and functions, to share scope of >non-global >vars. This is generally easily solved in Eu with included files though. > >Kat As I understand it, gosub could only be used inside functions, and would create a sort of nested procedure (no return value) resulting in something like: procedure myproc () ... gosub utility ... gosub utility ... return utility: ... return another_utility: return end procedure Karl Bochert -------Phoenix-Boundary-07081998---