
Syntax - Pod file describing syntax understood by Language::Basic module

There is no Language::Basic::Syntax module. This is just a pod file describing the syntax that's supported by the Language::Basic module.

Things in italics are objects. Things in boldface are actual strings (reserved words or punctuation). "[]" means optional, "..." means optionally more copies of the same thing, and things between slashes that look like Perl regexps are Perl regexps.
This syntax description probably isn't exactly correct from a computer science standpoint, but the idea is just to show what LB supports.
Line_Num Statement [: Statement ...]
Arglist must be made up of constant arithmetic expressions.
Var-Names must be scalar variables.
IF Or-Exp THEN Line_Num [ ELSE Line_Num ]
Note that, unlike C or Perl, Boolean values cannot be "cast" to non-Boolean (string or numeric) values and vice versa.
By the way, the classes in module Language::Basic::Expression rather closely mimic this syntax description.
Arith-Exp
Or-Exp
Mult-Exp Arith-Op Mult-Exp
String-Exp + String-Exp
Unary-Exp Mult-Op Unary-Exp
- Unary-Exp
(Arith-Exp)
Lvalue
Function
Constant
Var-Name [ Arglist ]
( Expression [ , Expression ...] )
Func-Name Arglist
Str-Const
Num-Const
Str-Const
Arith-Exp
The Arith-Exp must be made from Str-Exps.
And-Exp [ OR Or-Exp ]
Rel-Exp [ AND And-Exp ]
NOT Rel-Exp
Arith-Exp Rel-Op Arith-Exp
String-Exp Rel-Op String-Exp
( Or-Exp )
Numeric Identifier
String Identifier
/FN[A-Z]\w+/
/[A-Z]\w*/
/[A-Z]\w*\$/
Tokens, or atoms, are indivisible pieces of text making up a BASIC program
(Note: Language::Basic only pays attention to case in string constants.)
/\d+/
REM /.*/
Note that a comment goes all the way to the end of a line. Colons in a comment do not start a new statement.
DATA | DIM | DEF | END | FOR | GOSUB | GOTO | IF | INPUT | LET | NEXT | ON | PRINT | READ | RETURN | THEN | ELSE | TO | STEP
/(\d*)?\.?\d+/
/".*?"/
< | <= | > | >= | = | <>
+ | -
* | /
, | ;