BASICA to Pascal conversion

41 views
Skip to first unread message

Joselito G. Real

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to
Does anyone have access to a shareware program for converting BASICA or
QBASIC (not VB) programs into Pascal programs. I have tons of old BASICA
and even AppleSoft programs that I am converting manually into Delphi
Pascal units. These ANCIENT BASIC programs are the ones with line numbers
on almost every statement.
I bought Eagle Research VB2D but it does me no good because it strictly
converts only Visual BASIC projects. VB2D cannot even convert the following
program into a Delphi Pascal unit

BASICA program
10 CLS
20 PRINT "HELLO WORLD!"

It would be nice to have a small utility program that converts complete
subroutine code snippets from BASICA into Pascal.


.

The Patrician

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to Joselito G. Real

Joselito G. Real wrote:

> Does anyone have access to a shareware program for converting BASICA or
> QBASIC (not VB) programs into Pascal programs. I have tons of old BASICA
> and even AppleSoft programs that I am converting manually into Delphi
> Pascal units. These ANCIENT BASIC programs are the ones with line numbers
> on almost every statement.
> I bought Eagle Research VB2D but it does me no good because it strictly
> converts only Visual BASIC projects. VB2D cannot even convert the following
> program into a Delphi Pascal unit
>
> BASICA program
> 10 CLS
> 20 PRINT "HELLO WORLD!"
>

The trouble with this little piece of program code is that it calls the DOS
BIOS video I/O. This is not availeble in windows.

Peter N Roth

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to
Joselito G. Real wrote in message
<01be3920$04e66fa0$5824a2d1@z-reajos-pc>...
[ ]

>It would be nice to have a small utility program that converts complete
>subroutine code snippets from BASICA into Pascal.


You meant Delphi, rather than Pascal ?

Since those utilities that are available don't apply, why not write one
yourself,
in Delphi of course. You'll learn a lot.

You may also find that the tonnage that you have can be mostly
discarded, as Delphi encapsulates some of the things you had
to write in BASIC.
--
Grace + Peace | Peter N Roth | Engineering Objects Int'l
Amazon.com associate | Inprise Tool & Component Builder
http://www.inconresearch.com/eoi


Joselito G. Real

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to

Peter N Roth <refusi...@myaddress.com> wrote in article
<77013s$d0...@forums.borland.com>...


> You may also find that the tonnage that you have can be mostly
> discarded, as Delphi encapsulates some of the things you had
> to write in BASIC.

I am not talking about graphics, visual components, GUI's, and windows,
handling of files, user inputs and the like. I am talking about my vast
libraries of mathematical and statistical algorithms. My conversion has to
do more in writing Delphi units out of BASICA or QBASIC or GW-BASIC and
AppleSoft mathematical routines which to my best knowledge the source codes
HAS NEVER BEEN available in Delphi. I was forced to write very efficient
routines way back in college, as those routines (or subroutine libraries)
were run under interpreted language (BASIC) and I want to encapsulate in
Delphi the simplicity and elegance of those routines or algorithm
implementations which almost will never change across different languages.
Most of these are pure math and stat functions, nothing to do with windows.
So can you say now that Delphi has encapsulated these as well and can you
say that my routines can be discarded because they are available in Delphi?

I have been converting them mano y mano, from BASIC to Pascal, that it has
been a drag. I can't afford to make a conversion program either.

> You meant Delphi, rather than Pascal ?

In my case, I was after the language which is Pascal, Delphi Pascal
would be perfect, but I can live with other BASICA to Pascal (ANSI,
MicroSoft, Turbo, Delphi) converters. And since there are no GUI's
involved, no event driven loops, no OOP, no components, no Objects, no
Forms, no Projects, the conversion program should be simple as they are
from library to library of program statements. Of course, after I am done
with my conversions, I am going to optimize those routines, and encapsulate
them in OOP style, and put the visual or non-visual wrappers around them
all using Delphi. The conversion should save me 75% of my total time.

Robert Lee

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to
"Joselito G. Real" wrote:

> libraries of mathematical and statistical algorithms. My conversion has to
> do more in writing Delphi units out of BASICA or QBASIC or GW-BASIC and
> AppleSoft mathematical routines which to my best knowledge the source codes
> HAS NEVER BEEN available in Delphi. I was forced to write very efficient
> routines way back in college, as those routines (or subroutine libraries)
> were run under interpreted language (BASIC) and I want to encapsulate in
> Delphi the simplicity and elegance of those routines or algorithm
> implementations which almost will never change across different languages.
> Most of these are pure math and stat functions, nothing to do with windows.
> So can you say now that Delphi has encapsulated these as well and can you
> say that my routines can be discarded because they are available in Delphi?
>
> I have been converting them mano y mano, from BASIC to Pascal, that it has
> been a drag. I can't afford to make a conversion program either.

Not that a converter wouldn't be nice, but in my opinion, if you are going to
fool with them afterward anyways you might as well do them from scratch. A
converter is going to do a very literal translation, and considering that the
source languages aren't exactly structured lanugages you've probably got all
sorts of ugly code (GOTO's etc.) Additionally, if you optimized them way back
when, they've probably got all sorts of tricks in them that are almost
certainly inappropriate now. By the time you figure out what you originally
*meant* to do and weed out all that stuff you'll probably have used up most of
the time you would have saved rekeying and have uglier code too.

Bob Lee


Peter N Roth

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to
Joselito G. Real wrote in message
<01be399d$626e5840$a227a2d1@z-reajos-pc>...
[ ]

>So can you say now that Delphi has encapsulated these as well and can you
>say that my routines can be discarded because they are available in Delphi?

Of the Hello world sample, half the lines would be discarded...
The remaining 50% would convert into

program hw; begin writeln('hello, world!'); end.

which would then be passed to one of the formatters floating around to
make it legible.

>I have been converting them mano y mano, from BASIC to Pascal, that it has
>been a drag. I can't afford to make a conversion program either.

Actually, you _have_ a program converter, and it is made of flesh. So it's
really a question of the shape of the tool & its speed.

> The conversion should save me 75% of my total time.


you mean 75% of future analysis/computation time?

As Bob Lee suggested, & I agree, consider how you could move the algorithms
into
classes now. Extract the meat from the old programs, and provide them as
methods
for the classes. I opine that would simplify your task.

Anyway, the answer to your original question is still no.

Philippe Ranger

unread,
Jan 6, 1999, 3:00:00 AM1/6/99
to
Bob: >>By the time you figure out what you originally

*meant* to do and weed out all that stuff you'll probably have used up most
of
the time you would have saved rekeying and have uglier code too.
<<

Words of wisdom. The one thing that is hard to replace in existing code is
testing and debugging. Any conversion you do on the whole thing (e.g. from
Basica(!) to OP) means you test and debug from zero anyhow.

PhR

Joselito G. Real

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to

Robert Lee <rh...@nwu.edu> wrote in article <3693B896...@nwu.edu>...


> Not that a converter wouldn't be nice, but in my opinion, if you are
going to
> fool with them afterward anyways you might as well do them from scratch.
A
> converter is going to do a very literal translation, and considering that
the
> source languages aren't exactly structured lanugages you've probably got
all
> sorts of ugly code (GOTO's etc.) Additionally, if you optimized them way
back
> when, they've probably got all sorts of tricks in them that are almost

> certainly inappropriate now. By the time you figure out what you


originally
> *meant* to do and weed out all that stuff you'll probably have used up
most of
> the time you would have saved rekeying and have uglier code too.

But would you believe that my BASIC programs way back then were structured
nicely, with minimized or even non-existent use of GOTO. I would have
written them in Pascal but the only Pascal we have back then was JRT
Pascal, and it took more than 30 minutes to compile a single program in
AppleSoft running under CPM. When Turbo Pascal first came along, I was
already wrapping up my thesis, and so did not bother to convert them. Now
in my current Job, I found the need to get them back because those programs
were so nicely structured even if they were written in BASIC that even a
literal translation would still be nice. The only optimization that I can
push through might be using pointers while accessing array elements. Rather
than missing out a colon in the manual conversion, I can live with
tinkering the literal translation into a Pascal Code.

Well my question was simple enough if there exists some code converters or
not. There is one site though which says Converting from BASIC to Turbo and
back, somehow the server is not responding.

Volker W. Walter

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to Joselito G. Real

"Volker W. Walter" wrote:
>>> BASICA or QBASIC

For HP-(Rocky Mountain) Basic, I have a translator. With this I could
translate about 1000 to 2000 lines per day to Borland Pascal 7

Volker

Colin Wilson

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to
> small utility program

It sounds like it would be a *large* utility program, if it were to
work properly.

Maybe it would be more flexible if you wrote a TBasicInterpretter
component for Delphi, then you could override it to handle the
different dialects (TBasicAInterpretter, TApplesoftInterpretter,
TPDP8BasicInterpretter, etc.). Then you could run your original basic
code snippets from within your Delphi program.

Colin
e-mail :co...@wilsonc.demon.co.uk
web: http://www.wilsonc.demon.co.uk/delphi.htm


Volker W. Walter

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to co...@wilsonc.demon.co.uk


> It sounds like it would be a *large* utility program, if it were to
> work properly.

Sorry, I forgot to tell the main restrictions:
- The translator is 390 KB and runs on a HP 300 computer (MC 68000) in
HP Basic.
- I use a so called VIPER-card in my PC: an HP 300 computer without
CRT.
- The program is protected by an HPIB (IEEE488)-Dongle
- I bought this program about 10 years ago for about 2000 DEM (+- 1000
DEM)

But I used it very heavily, and it saved at minimum 100 working days.

I used it also to translate from FORTRAN via HP-BASIC to Pascal,
with a self (pascal-written) FORTAN to HP-Basic converter (2000 lines,
60k).

HP Rocky Mountain Basic is nearly FORTRAN with SUBROUTINES, COMMON,..
and dynamic arrays, but without EXTERNAL and all non-typesafe tricks.

It has a lot of pascal features (IF THEN ELSE, WHILE, LOOP), but no
pointers,
not nested datastructures, no nested procedures.

Volker

Brontesav

unread,
Sep 1, 2020, 3:07:55 AM9/1/20
to
Reply all
Reply to author
Forward
0 new messages