This is an old revision of the document!
Table of Contents
Mystic Programming Language
General Notes About Using The MPL
The syntax of the Mystic BBS Programming Language follows closely to that of the Turbo Pascal series of programming compilers. At one time, the language was almost 100% Turbo Pascal compatible (except for the BBS functions) but it has been slightly changed to make it a little more friendly to the programmer.
Two versions of the programming compiler are available in the scripts directory. The first one, MIDE.EXE, is a fully functional IDE for creating and compiling MPE programs. This program looks similar to the Turbo Pascal IDE, including syntax highlighting of all command keywords! The second version of the compiler is MPLC.EXE. This is a command line compiler supplied so you are not forced to use MIDE.EXE to write programs. If you do not find the MIDE interface to be satisfactory, then you can use your favorite text editor and MPLC.EXE to create programs!
The following are some quick notes about the syntax of the language as well as some notes about things that aren't working as they probably should be:
Comments
All text after a two slashes (⁄⁄) is considered a comment. It will be ignored until the next line of code. For example:
WriteLn ('Hello There') ⁄⁄ This is a comment and will be ignored.
Operation types
The MPL does not follow the order of operations when doing mathmatical equations (ie PEMDAS - parenthesis, exponents, multiplication, division, addition, subtraction). So math functions are done in the order that they appear in the expression.
This doesn't mean its not POSSIBLE to do PEMDAS-ordered expressions, it will just take a little more effort on the programmer's behalf.
The following operation codes are supported for mathematical equations:
− Subtract + Addition * Multiplication ⁄ Division % Modulus Operator
Bitwise math
MPL fully supports bitwise math and operators! The following are implemented:
AND - Bitwise AND OR - Bitwise OR XOR - Bitwise exclusive OR SHL - Bitwise shift left SHR - Bitwise shift right
Example:
Const UserDeleted = $04; // established bit for userdeleted from records.pas // note: this value has changed check records.pas! Begin GetThisUser If UserFlags AND UserDeleted <> 0 Then WriteLn('User is deleted'); End;
Defining Variables
All variables are global to all of the program, including procedures. The syntax for declaring a variable follows:
Var <VarName> : <VarType> Examples: var dummy : byte var str : string var dummy : byte, str : string
The following variable types are supported:
Type Format Range --------------- -------------- ---------------------------- Boolean FALSE/TRUE 0..1 Char Text 1 character String Text Sequence of 1..255 characters Byte Numerical 0..255 Integer Numerical -32767..32767 Word Numerical 0..65535 LongInt Numerical -2147483648..214748364 Real Numerical 9.99
All variables except ARRAYs can be initialized when when defined.
Var TotalBases : LongInt = GetMBaseTotal(False) Var Int : Integer = 33 Var Str : String = 'This is a string'
ARRAY multi-dimensional variables are supported. The syntax for declaring an array variable is:
Var <VarName> : ARRAY[<Low>..<High>] of <VarType> Var <VarName> : ARRAY[<L>..<H>, <L>..<H>] of <VarType>