Basic Dialect

LA.Docs
March 1st, 2016

The Basic Dialect


Basic Syntax Definitions

Program -> Statements
Statements -> (EOL | StatementList EOL)...
StatementList -> Statement/’:’...
ImportStmt -> IMPORTS (String/,)...
DimStmt -> DIM (VarDecl/’,’)...
VarDecl -> Ident [Array] [AsClause] [InitValue]
AsClause -> AS Ident
Array -> ’[’ ArrayDim/’,’... ’]’
ArrayDim -> Expression
InitValue -> ’=’ Expression
Expression -> SimpleExpression [RelOp SimpleExpression]...
SimpleExpression -> [’-’] Term [AddOp Term]...
Term -> Factor [MulOp Factor]...
Factor -> Designator
       -> UnsignedNumber
       -> String
       -> ’(’ Expression ’)’
       -> NOT Factor
       -> NewOperator
       -> ’<’ FRString ’>’
SetConstructor -> SetNode/’,’...
SetNode -> Expression [’..’ Expression]
NewOperator -> NEW Designator
RelOp -> ’>’ -> ’<’ -> ’<=’ -> ’>=’ -> ’<>’ -> ’=’ -> IN -> IS
AddOp -> ’+’ -> ’-’ -> ’&’ -> OR -> XOR
MulOp -> ’’ -> ’/’ -> ’\’ -> MOD -> AND
Designator -> [ADDRESSOF] Ident [’.’ Ident | ’[’ ExprList ’]’ |
           ’(’ [ExprList] ’)’]...
ExprList -> Expression/’,’...
Statement -> BreakStmt
          -> CaseStmt
          -> ContinueStmt
          -> DeleteStmt
          -> DimStmt
          -> DoStmt
          -> ExitStmt
          -> ForStmt
          -> FuncStmt
          -> IfStmt
          -> ImportStmt
          -> ProcStmt
          -> ReturnStmt
          -> SetStmt
          -> TryStmt
          -> WhileStmt
          -> WithStmt
          -> AssignStmt
          -> CallStmt
BreakStmt -> BREAK
ContinueStmt -> CONTINUE
ExitStmt -> EXIT
DeleteStmt -> DELETE Designator
SetStmt -> SET AssignStmt
AssignStmt -> Designator [’+’|’-’|’’|’/’]’=’ Expression
CallStmt -> Designator [’+’’+’|’-’’-’]
ReturnStmt -> RETURN [Expression]
IfStmt -> IF Expression THEN ThenStmt
ThenStmt -> EOL [Statements] [ElseIfStmt | ElseStmt] END IF
         -> StatementList
ElseIfStmt -> ELSEIF Expression THEN
         (EOL [Statements] [ElseIfStmt | ElseStmt] | Statement)
ElseStmt -> ELSE (EOL [Statements] | Statement)
CaseStmt -> SELECT CASE Expression EOL
         (CaseSelector...) [CASE ELSE ’:’ Statements] END
         SELECT CaseSelector -> CASE SetConstructor ’:’ Statements
DoStmt -> DO [Statements] LOOP (UNTIL | WHILE) Expression WhileStmt
       -> WHILE Expression [Statements] WEND
ForStmt -> FOR Ident ’=’ Expression TO Expression [STEP Expression] EOL [Statements] NEXT
TryStmt -> TRY Statements (FINALLY | CATCH) [Statements] END TRY WithStmt
        -> WITH Designator EOL Statements END WITH
ProcStmt -> SUB Ident [FormalParameters] EOL [Statements] END SUB
FuncStmt -> FUNCTION Ident [FormalParameters] [AsClause] EOL
[Statements] END FUNCTION
FormalParameters -> ’(’ (FormalParam/’,’)... ’)’
FormalParm -> [BYREF | BYVAL] VarList