Statement and Syntax

 

| HOME |

Noobeed is an interpreter, meaning that it reads one statement at a time, then executes it, then goes on to the next statement and repeats the same, over and over.  At the Noobeed prompt, "->", the user types a statement, once enter is pressed, Noobeed reads it and executes it immediately.  It is not until Noobeed finishes the current execution and returns the prompt to the user that the user can enter another statement.  The same concept also works when running a program in Noobeed,i.e. it processes the program statement line by line, one line at a time, from the top to the bottom of the program.

There are 3 types of statement

  • command statement

  • expression statement

  • assignment statement

The following is to give an idea how the interpreter works.

  • Each statement in a program is read into Noobeed as a String, and is “left trim” and “right trim” before store into memory.  Therefore white spaces at the beginning and the end of a statement play no roll at all.

  • Noobeed scans the whole statement.  If illegal characters are found, an error is reported.  All possible legal characters are listed at below.

  • Noobeed looks at the first word in the statement.  If it is a command, this is a command statement.

  • If not a command statement, Noobeed scans for an equal sign, "=".  If found, this is an assignment statement.

  • If not an assignment statement, it is an expression statement.

 

Example

-> a = Matrix(3,3) 

this is an assignment statement

-> b = sin(deg(89.2563))

this is an assignment statement

-> 25 * (4.2+5.3)

this is an expression statement

-> set format "fix"

this is a command statement

The space or blank characters play no role in the statement, for example:

->a = b.tsp ()

"tsp " is trimmed out as "tsp"

->john = matrix()

"john " is trimmed out as "john"

Legal characters 

letters (upper case)

A-Z

letters (lower case)

a-z

numbers

0-9

underscore sign

_

all operator signs

+ - * / ^ % > < <> >= <= ! & |

blank (white space)

    ASCII code 32

decimal point

.   ASCII code 46

comma

,   ASCII code 44

semi colon

;   ASCII code 32

parenthesis

()  ASCII code 40, 41

bracket 

[]  ASCII code 91, 93

double quotation

"   ASCII code 34

Any characters that are NOT listed here are illegal characters.

 

Precedence

The following lists the level of priority of operator from highest to lowest.  If same precedence, then they are done from left to right.

Function()

global, class and L-functions (a constant Matrix created by using [ ] is also treated as a function)

! + -

Unary (! is from right to left)

(   )

expression in a parentheses

^

power

* / %

multiply, division, modulus (remainder)

+ -

plus, minus

< <= > >=

less than, less or equal to, greater than, greater than or equal to

== <>

equal to, not equal to

&

and

|

or

 


| HOME