FreeBASIC - programming language

  • Thread starter (ProteanThread)
  • Start date
P

(ProteanThread)

http://www.freebasic.net/

FreeBASIC - as the name suggests - is a free, open-source, 32-bit,
MS-QuickBASIC's syntax-compatible compiler, that adds new features such
as pointers, unsigned data types, inline-assembly and many others.


The most important features are:

* syntax compatible with Microsoft's QBASIC/QuickBASIC/PDS/VBDOS
interpreters/compilers:

o FreeBASIC is not a "new" BASIC language, you don't have to
learn anything new if you already know any MS-BASIC variant
o case-insensitive, scalar variables don't need to be
dimensioned, supports line numbers, no MAIN functions and so on..
o please note that compatibility doesn't mean you can
compile a source-code made for QuickBASIC and hope it will run fine (it
may compile fine!)

* clean syntax:

o only a small number of keywords were added, all functions
are implemented as libraries, there's not a single new intrinsic
routine, like MSGBOX of example, so there's no variable clashes with old
code. if you want to show up a msg box in Windows, simply do:
'$include: 'user32.bi'
MessageBox NULL, "Title", "Text", MB_ICONASTERISK

(note, MessageBox is case-insensitive, it can be MESSAGEBOX
if you want)

* great number of variables types, like BYTE/SHORT/INTEGER,
SINGLE/DOUBLE and STRING:

o all integer types have unsigned versions
(UBYTE/USHORT/UINTEGER)
o strings can be fixed or variable-length (up to 2GB long!)

* user defined types (UDT's):

o unlimited nesting

o

QB's TYPE and UNION's (including nameless inner-unions):

type MYTYPE
a as short
b as integer
c as short
d as OTHERTYPE
union
e as double
f as single
g as OTHERTYPE
end union
h as byte
end type

union MYUNION
a as integer
b as short
c as double
end union

o

array fields, up to 4 dimensions, ex:

type MYLIST
mylist(0 to MAXITEMS-1) as MYITEM
end type

o

function field types:
type SOMETYPE
myfunc as function( byval arg1 as integer ) as integer
end type

* enum's (Enumerations):

enum MYENUM
A
B = 3
C
end enumv
dim e as MYENUM

e = C (ie, e = 4)

* arrays:

o

dynamic and static, up to 2GB
o

unlimited number of dimensions
o

any lower and upper bounds
o

redim preserve

* pointers:

o

pointers to *any* variable listed above, including UDT's
and arrays
o

uses the same syntax as in C, ex:
currNode->nextNode->prevNode = NULL
*a = *b \ **c
o

unlimited indirection levels (pointer to pointer to pointer
to ...)
o

function pointers:

dim myptr as sub( byval arg1 as function( byval arg
as integer ), byval arg2 as double )
dim otherptr as as function( byval arg as integer )

myptr = @realsub()
myptr( otherptr, f )

sub realsub( byval arg1 as function( byval arg as
integer ), byval arg2 as double )

res = arg1( a+b ) * arg2

end sub

* optional function arguments (numeric only):

declare sub bar( foo1 as double = 12.345, byval foo2 as byte =
255 )

bar
bar( )
bar , 128
bar ,
bar 123.4,
bar 123.4


* inline assembly:

o

intel syntax
o

reference variables by name, no trick code needed

* pre-processor:

o

same syntax as in C (less for complex #define's, that are
not supported)

#define SOMEDEF 1234
#define OTHERDEF 5678
#ifdef SOMEDEF
# if not defined( OTHERDEF )
# define OTHERDEF SOMEDEF
# else
# if OTHERDEF <> SOMEDEF
# undef OTHERDEF
# define OTHERDEF SOMEDEF
# endif
# endif
#else
# define OTHERDEF 5678
#endif
#print OTHERDEF


* creates OBJ's, LIB's, DLL's/Shared Libs, console and GUI EXE's

o

you are in no way locked to an IDE
o

create static libraries as before

* as a 32-bit application:

o

FB can compile source-code files up to 2GB long
o

the number of symbols (variables, constants, etc) is only
limited by the memory available (you can include/use for example opengl
+ sdl + bass + win api with your application)

* optimized code generation:

o

while FreeBASIC isn't an optimizing compiler, it does many
kinds of optimizations to generate the fastest possible code on x86
CPU's, not losing to other BASIC alternatives, including the commercial ones

* completely *FREE*:

o

all 3rd party tools are also free, no piece of abandoned or
copyrighted software is used. assembler, linker, archiver and other
cmd-line tools came from the (awesome) Mingw32 project (the GCC Windows
port)

* portability:

o

runtime-lib is being written with portability in mind, OS
dependent functions are being separated to make porting easy later
o

compiler is written in 100% in FB (that's it, FreeBASIC
compiles itself), and all modules are independent, porting to other OSes
on the x86 platform won't be too difficult
o

as all tools used also exist on other OSes and can even
create cross-platform executables, that will make the porting easier

--
Woodzy

http://www.rtdos.com (alt OS for games based on the classics)
http://x.webring.com/hub?ring=campaignforbroad ( campaign for more
broadband internet access )
 
C

Chaos Master

This is (ProteanThread) for forever:
http://www.freebasic.net/

FreeBASIC - as the name suggests - is a free, open-source, 32-bit,
MS-QuickBASIC's syntax-compatible compiler, that adds new features such
as pointers, unsigned data types, inline-assembly and many others.

Thanks! I needed a BASIC compiler, to port really old MS-DOS
applications written in BASIC and that ran using QuickBASIC, to Windows.

(that is because QuickBASIC only can use 640KB RAM, it seems.)
--
Chaos Master®, posting from Canoas, Brazil - 29.55° S / 51.11° W / GMT-
2h / 15m

"He [Babya] is like the Energizer Bunny of hopeless newsgroup
posting....or should that be Energizer bBunny"
- "ceed" on alt.comp.freeware, 24/1/2005

(to some groups: Yes, I use Windows and MS Office. So what?)
 
M

Mouse

(ProteanThread) said:
http://www.freebasic.net/

FreeBASIC - as the name suggests - is a free, open-source, 32-bit,
MS-QuickBASIC's syntax-compatible compiler, that adds new features
such as pointers, unsigned data types, inline-assembly and many others.

So where's the download link? Doesn't seem to have one.
 
M

Mouse

XemonerdX said:
It's the button that says 'downloads' at the top of the page :)

What button? I see: About, Docs, Forum, Links. No "Download".
What URL are you looking at? Definitely not the one above...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top