I might have to take a look at MS. Is the syntax similar to MPL? I guess if I took a look, I would be able to find out for myself... <smack> :)
Yes, it is Pascal-like and it has a lot of new language features too like significantly better array handling, pointers, inheritance, overloading, no string limitations, default parameters, 64 bit integers, etc.
You can use usage.mps and usage.ms in the latest A48 build to compare how close the code is. I can also give you this too (but keep in mind I am not 100% sure I will use MS or not yet as the future MPL):
DIFFERENCES FROM TURBO/FREEPASCAL/MPL
=====================================
-- Boolean evaluations must be surrounded in parenthesis. This works the same
as Turbo/Free Pascal but different than MPL. In MPL allows multiple
evaluations to be defined without parenthesis like so:
MPL: If Deck[6].Card = CardJack or Deck[7].Card = CardJack Then
Mystic Script/Turbo/FreePascal:
If (Deck[6].Card = CardJack) or (Deck[7].Card = CardJack) Then
-- Function results must be assigned to "Result" not function name
Many Pascal compilers assign function results to the result variable not
the function name as in Turbo Pascal and MPL. For example:
TurboPascal/MPL:
Function MyFunction : Byte;
Begin
MyFunction := 10;
End;
FreePascal/Delphi/Mystic Script:
Function MyFunction : Byte;
Begin
Result := 10;
End;
-- Case statements "Else" does not have an "assumed Begin/End"
Turbo Pascal:
Case 1 of
2: WriteLn('2');
Else
// Single statement here or multiple statements in Turbo Pascal are okay
WriteLn('Case else');
WriteLn('Value is not 2');
End
Mystic Script:
Case 1 of
2: WriteLn('2');
Else
// Single statement here is okay, but you must enclose multiple statements
// in a begin/end like this:
Begin
WriteLn('Case else');
WriteLn('Value is not 2');
End;
End;
-- Case statements function with string values now:
MyString := 'Hello';
Case MyString of
'Hello': WriteLn('Hello to you!');
End;
This would cause a syntax error in FreePascal or TurboPascal but it works
in Mystic Script.
-- Semi-colons as statement enders are stricter in Mystic Script. MPL and
even Free Pascal is not as strict, so when porting code you may need to add
in some semicolons that you missed in your source code. You need to have
the period after End. in your main program block to signify the end of the
script, etc. There is no compilation so it is more strict with its syntax.
-- When defining default values for records or arrays they must be enclosed in
brackets ([]) instead of parenthesis.
Turbo Pascal:
MyArray : Array[1..4] of Byte = (1,2,3,4);
Mystic Script:
MyArray : Array[1..4] of Byte = [1,2,3,4];
-- Default values for a record do not require the element name. Values should
be defined in order of appearance within the record:
Type
MyRec = Record
A : Byte;
B : Byte;
End;
Turbo Pascal:
Var R: MyRec = (A:0; B:0);
Mystic Script:
Var R: MyRec = [0,0];
-- Multi-dimensional arrays are not declared with TurboPascal shortcuts:
Mystic Script:
Var Grid: Array[1..40] of Array[1..40] of Byte;
TurboPascal/MPL:
Var Grid: Array[1..40, 1..40] of Byte;
-- String types are not limited to 255 characters in Mystic Script.
-- Shutdown must abort script exection.
In MPL scripts will automatically terminal when a shutdown happens but this
convience comes at the expense of being able to handle a shutdown event such
as a user disconnection.
Mystic Script works similar to Mystic Python in that the shutdown event
must be tested for and your script must exit when it is True. This means
that all types of input that would stop the script must be enclosed in a
test for Shutdown. For example:
Repeat
Write ('Menu Prompt (Q/Quit): ');
Case (Readkey) of
'Q' : Break;
End;
Until Shutdown;
// We get here when the user presses Q or Shutdown is True
... Help! I can't find the "ANY" key.
--- Mystic BBS v1.12 A48 2022/03/26 (Windows/64)
* Origin: Sector 7 * Mystic WHQ (1:129/215)