7Basic Logo
A powerful, yet easy to use BASIC compiler for Windows

Menu

Login
Username:

Password:



Language Guide


This guide may change as new types/declarations/statements are added to 7Basic.

Language Overview

7Basic is a hybrid language when it comes to case sensitivity. Reserved words may be in any case, but identifiers must be used in the same case as when they were defined.

File Contents
A 7Basic source file consists of a single file with one or more statements. Each statement is separated by one or more newlines.

Statement Types
A statement can be any of the following:

  • A variable, class, or function declaration
  • An assignment statement
  • An IF THEN clause
  • A WHILE clause
  • A FOR clause
  • Postfix increment or decrement

Variable Declarations
A variable declaration consists of the reserved word DIM, an unused identifier, the word AS, and the variable type, which may be any of the following:

  • INTEGER
  • STRING
  • FLOAT
  • A previously defined class

Function Definitions
A function definition consists of the reserved word FUNCTION, an unused identifier, an opening parenthesis, the argument list, a closing parenthesis, the word AS, and a type. The argument list consists of one or more arguments separated by commas. An argument consists of an identifier, the word AS, and a type. The function can include a return statement.

Class Definitions
A class declaration consists of the reserved word CLASS, an unused identifier, one or more declarations, and the words END CLASS. Variable declarations as well as function declarations may be present in the class declaration.

Return Statements
A RETURN statement simply consists of the reserved word RETURN followed by an expression. It may appear only in a function.

If/Then Statements
An IF THEN clause consists of the reserved word IF, an integer expression, the word THEN, one or more statements, and the words END IF.

While Statements
A WHILE statement consists of the reserved word WHILE, an integer expression, one or more statements, and the words END WHILE.

For Statements
A FOR statement consists of the reserved word FOR, an integer expression, the word TO, another integer expression, the word USE, an unused identifier, one or more statements, and the words END FOR.

Postfix Increment/Decrement Statement
A postfix increment or decrement statement consists of an identifier and either ++ or --.

Include Directive
7Basic supports include files by using the word INCLUDE followed by a string literal.


Copyright (C) 2009 - Nathan Osman