Recent

Author Topic: Heat from FreeBasic  (Read 3467 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #30 on: April 15, 2019, 06:07:33 pm »
What do you think about basic256?

I usually look at a sizeable example application to judge a language. E.g. an IDE. Where can I find that for basic256 ?

Too many aspects of a development system are simply not stressed by 20 lines programs and math problems.

Quote
First sight I think it's the language for kid but when looked throughout the document I saw it rather complete (in it own sense) with not only drawing function which is the traditional strength of basic but also good and simple regular expression. I saw the potential to be a automation solution like autoit but is cross platform.

Regular expressions are a cesspit. You are pulling an interpretive solution into your language, and the overuse leads to constant expansion of it. While FPC also has regex, for many simple cases (like splitting by a single char) you can better use ready to use routines. Like string.split used below.

Quote
Is there anything equivalent in free pascal can do  like the example on this page with ease?

That example is a bit verbose, just to number the results. I can transfer it 1:1, but that is not how you would usually do it. I translated a more normal way, using trunk/3.2:

Code: Pascal  [Select]
  1. {$mode delphi}
  2.  
  3. uses sysutils;
  4.  
  5. var a,b : string;
  6. begin
  7.   // explode on spaces
  8.   a := 'We all live in a yellow submarine.';
  9.   writeln('Original string:', a );
  10.   for b in a.split(' ') do
  11.     writeln('Item =',b);
  12.  
  13.   // explode on A or a
  14.   a:= 'klj;lkjalkjAlkj;';
  15.   writeln('Original string:', a );
  16.   for b in a.split(['a','A']) do
  17.     writeln('Item =',b);
  18.  
  19.   // explode numbers on comma
  20.   a:='1,2,3,77,foo,9.987,6.45';
  21.   writeln('Original string:', a );
  22.   for b in a.split(',') do
  23.     writeln('Item =',b);
  24. end.

« Last Edit: April 15, 2019, 06:11:37 pm by marcov »

ASBzone

  • Full Member
  • ***
  • Posts: 202
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: Heat from FreeBasic
« Reply #31 on: April 15, 2019, 06:18:12 pm »
I learned programming started with BASIC. First time trying Pascal, I felt it was too verbose. But after using it for a while, I'm okay with it.

I first learned BASIC on a TRS-80 Model 1, and then on a TRS-80 Model 4.

Then I learned BASIC on the C64, then assembler on the C64.  That was cool stuff.

Then I finally learned BASIC and Pascal on a DEC PDP-11/44.   I was in heaven with Pascal.

I later learned BASIC on the PC, including QuickBasic, but my favorite BASIC was actually AmigaBASIC, written by Microsoft.

I dabbled in VisualBasic, VisualC and others, but by then I was an infrastructure guy.      I came back in search of Pascal around 2012 when I wanted to write a couple utilities for myself, and didn't like the C options (C,. C++, C#).    I found FreePascal and have been happy since...

-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.3 r60988 / FPC v3.2.0-beta-r41873 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1809 (Build 17763.379)
Other Systems: Windows 10 Pro x64, Version 1803 or greater

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #32 on: April 15, 2019, 06:22:23 pm »
Is there anything equivalent in free pascal can do  like the example on this page with ease?
http://doc.basic256.org/doku.php?id=en:explode
My way is traditional for loop  ;)

Something like this below?

Code: Pascal  [Select]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Data       : string;
  4.   ResultData : TStringArray;
  5.   i          : Integer;
  6. begin
  7.   Data := 'We all live in a yellow submarine.';
  8.   ResultData := Data.Split(' ');
  9.   for i := Low(ResultData) to High(ResultData) do
  10.     ShowMessage(ResultData[i]);
  11. end;

I use only strutils. First I use wordcount to count number of words, create an array using this number and then for and extractword... All done on my phone using an online fpc compiler site so I can't copy it here because I already closed that tab, too lazy to redo it with phone keyboard.

@marcov: basic256 has a qt based ide.

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #33 on: April 15, 2019, 06:32:00 pm »
I'm too tired so overlooked it. Basic256 is something like Microsoft Small Basic but open source, it is for teaching programming but not professional use. My bad. Bye everyone, 11:30pm in my place.

Handoko

  • Hero Member
  • *****
  • Posts: 2991
  • My goal: build my own game engine using Lazarus
Re: Heat from FreeBasic
« Reply #34 on: April 15, 2019, 06:46:52 pm »
For Linux users who love BASIC, maybe you should check Gambas:
http://gambas.sourceforge.net/

- A compiler, an interpreter, an archiver, a development environment, many extension components
- Gambas is a true object-oriented language
- Runs on GNU/Linux only

I'm too tired so overlooked it. ... Bye everyone, 11:30pm in my place.

You sleep too early. Programmers usually sleep at 3 AM. :D
« Last Edit: April 15, 2019, 06:50:05 pm by Handoko »

Handoko

  • Hero Member
  • *****
  • Posts: 2991
  • My goal: build my own game engine using Lazarus
Re: Heat from FreeBasic
« Reply #35 on: April 15, 2019, 07:03:53 pm »
I dabbled in VisualBasic, VisualC and others, but by then I was an infrastructure guy.      I came back in search of Pascal around 2012 when I wanted to write a couple utilities for myself ...

You have many experience with BASIC. VB had good reputation at that time and you had already learned it, I wonder why you didn't use VB to write the utilities.

ASBzone

  • Full Member
  • ***
  • Posts: 202
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: Heat from FreeBasic
« Reply #36 on: April 15, 2019, 07:16:49 pm »
You have many experience with BASIC. VB had good reputation at that time and you had already learned it, I wonder why you didn't use VB to write the utilities.

They were console utilities, and VB.NET was not as flexible as I wanted there.
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.3 r60988 / FPC v3.2.0-beta-r41873 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1809 (Build 17763.379)
Other Systems: Windows 10 Pro x64, Version 1803 or greater

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #37 on: April 15, 2019, 07:19:44 pm »
@marcov: basic256 has a qt based ide.

Is it written in basic256 ? I only said IDE as a non trivial example of what the language can do, rather than the usual short examples.

Munair

  • Sr. Member
  • ****
  • Posts: 415
  • Keep it simple.
    • Ditrianum
Re: Heat from FreeBasic
« Reply #38 on: April 15, 2019, 07:33:33 pm »
For Linux users who love BASIC, maybe you should check Gambas:
http://gambas.sourceforge.net/

- A compiler, an interpreter, an archiver, a development environment, many extension components
- Gambas is a true object-oriented language
- Runs on GNU/Linux only

I checked out Gambas a view times in the past. Last time is quite a while ago. I never managed to create a project and start coding. It could have been me, or Gambas just isn't intuitive / straight foward. I remember having issues operating the IDE. I know it's been around for years, but my impression is it doesn't seem to be very popular.
Lazarus 2.0.0; Manjaro Linux; Windows 10 x64;

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #39 on: April 16, 2019, 03:51:18 am »
For Linux users who love BASIC, maybe you should check Gambas:
http://gambas.sourceforge.net/

- A compiler, an interpreter, an archiver, a development environment, many extension components
- Gambas is a true object-oriented language
- Runs on GNU/Linux only

I'm too tired so overlooked it. ... Bye everyone, 11:30pm in my place.

You sleep too early. Programmers usually sleep at 3 AM. :D

I'm a farmer not programmer. After a tired day if I not sleep before 12pm my brain will shut down  :)

As for gambas, I like it syntax much more than freebasic. I familiar with vb but not qb based ones. The biggest problem with it is no first class windows support, you will have to go with a lot of cygwin crap to just got it running and what about deploying the output app? Do I need this same cygwin crap again to got my script just running?

And gambas support freebsd too, not only linux. Another problem is some doc is only french. I don't know if they fixed it.

About vb like syntax but cross platform deployment have a look at b4j (basic for java). The ide is windows only (has vs studio look) but resulted app is cross platform. This b4j transpile to java to use javac and utilize javafx.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 892
    • Burdjia
Re: Heat from FreeBasic
« Reply #40 on: April 16, 2019, 11:39:55 am »
It's being time since I used QuickBASIC.  I made small snippets BASIC for MSX sometimes but I miss QB.  You're forcing me to test FreeBasic.  I warn you I would change my favorite programming language... ;D

The only part getting some attention seems to be fbgfx. Freebasic is more game oriented than FPC.
We're working on this issue.  8)
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #41 on: April 16, 2019, 02:14:36 pm »
@marcov: basic256 has a qt based ide.

Is it written in basic256 ? I only said IDE as a non trivial example of what the language can do, rather than the usual short examples.
I misunderstood you. I think you asked if it has an ide and I answer it has one. Sorry. The ide is written in C++  :-[

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #42 on: April 16, 2019, 02:18:30 pm »
You have many experience with BASIC. VB had good reputation at that time and you had already learned it, I wonder why you didn't use VB to write the utilities.

They were console utilities, and VB.NET was not as flexible as I wanted there.
If I didn't wrong some crack tools were written in vb.net  ;D

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #43 on: April 16, 2019, 02:20:50 pm »
Quote
Is it written in basic256 ? I only said IDE as a non trivial example of what the language can do, rather than the usual short examples.
I misunderstood you. I think you asked if it has an ide and I answer it has one. Sorry. The ide is written in C++  :-[

No I always look at sizeable applications if I evaluate a language. And it seems basic256 is really basic education only. Not a code fragment longer than a few tens of lines on the whole site it seems.

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #44 on: April 16, 2019, 02:23:29 pm »
It's being time since I used QuickBASIC.  I made small snippets BASIC for MSX sometimes but I miss QB.  You're forcing me to test FreeBasic.  I warn you I would change my favorite programming language... ;D

The only part getting some attention seems to be fbgfx. Freebasic is more game oriented than FPC.
We're working on this issue.  8)
Have a look at QB64. It's more compatible with the original QB than FB. It transpile to c++ (not c) and use g++ so very good performance. QB64 is game oriented. The only thing it lacked is a decent ide. It only has a text mode ide.