morilib qbflat


Back


Fundermental

The morilib qbflat is a high order calculator language which has Quick/Visual BASIC like syntax.
The word which reserved as functions and statements are available as a variable.
The valid variable name begins ASCII alphabets and follows ASCII alphabets or numbers.
Qbflat has only numeric(IEEE double) type.
The value is true if the value is not zero, otherwise The value is false.
In qbflat, the case of alphabets is distinguished.

Subroutines and functions can be defined.
The syntax of defining a function shown as follows.

Function name (argument ...)
  statement
  ...
End Function
To assign a value to function name, you can specify the return value of the function.

The syntax of defining a subroutine shown as follows.
To assign a value to function name, you can specify the return value of the function.

Sub name (argument ...)
  statement
  ...
End Sub


Expressions

In qbflat, the expressions shown as follows. Using "()", you can change priority of operator.
- High priority -
operator association description
(unary)- sin cos tan exp log left to right negate the sign, computing sin, cos, tan, exp and log, respectively
You can use the power of trigonometric function as sin^positive-value.
You can compute the power of inverted trigonometric function as sin^negarive-value.
You can also specify the base of logarithm as log_base.
^ right to left power
* / left to right multipication, division
+ - left to right addition, subtraction
= left to right 1 if both value is equal, otherwise 0
<> left to right 1 if both value is not equal, otherwise 0
< left to right 1 if the left value is less than the right value, otherwise 0
> left to right 1 if the left value is more than the right value, otherwise 0
<= left to right 1 if the left value is less than or equal to the right value, otherwise 0
>= left to right 1 if the left value is more than or equal to the right value, otherwise 0
Not left to right logical not
And left to right conjunction
Or left to right logical sum


Statements

varname=expr
assigns expression to variable.

Print expr
prints expression or string to text screen.

If expr1 Then
stat1
...
[ElseIf expr2 Then
stat2
...]
[Else
statn
...]
EndIf
executes stat1 if expr1 is true, stat2 if expr2 is true, otherwise statn.
Else clause is optional.

For varname=expr1 To expr2 [Step number] / Next
assigns expr1 to varname, execute until Next appear, and increases variable by number(default 1).
The loop repeats until variable is more than expr2.

Do While expr
statements
Loop
executes statements while expr is true.

Do Until expr
statements
Loop
executes statements until expr is true.

Do
statements
Loop
executes statements forever. To exit the loop, you can use Exit Loop statement.

Do
statements
Loop While expr
executes statements while expr is true. statements will be executed at least one time.

Do
statements
Loop Until expr
executes statements until expr is true. statements will be executed at least one time.

Exit For/Loop/Sub/Function
exits For/Do-Loop/subroutine/function, respectively.

subroutine-name[(arguemnt ...)]
calls a subroutine.