7Basic

From Rosetta Code
7Basic is an implementation of BASIC. Other implementations of BASIC.
7Basic is an example of a compiler. You may find the programming tasks that have been solved using it here.

7Basic is both a programming language and the cross-platform compiler that generates x86 assembly code from 7Basic source files. The language is heavily based on other BASIC-derivatives like QuickBASIC while also providing classes and pointers, although the spec. for the language is in constant flux at the moment.

Compiler[edit]

The compiler currently is capable of generating x86 assembly code (with x87 FPU instructions) that target the Linux operating system. Plans are underway to have the compiler generate native x86 machine code not only for Linux but for other operating systems as well. The language currently supports simple constructs such as PRINT, INPUT, WHILE, and variable declarations. Nearly all math and logic operators have been implemented.

Sample[edit]

The following example can be compiled by supplying it as a parameter to the compiler:

 
' Store the user's age
DIM age AS INTEGER
 
' Ask the user for their age
PRINT "Enter your age:"
INPUT age
 
' Tell them their age in 5 years
PRINT "In 5 years, you will be:"
PRINT age+5
 

Links[edit]