Prexonite Script

Prexonite Script (or PXS for short) is a high level programming language targeted at the Prexonite scripting engine.

Prexonite Script:
  1. function main
  2. {
  3.     println("Hello World");
  4. }

PXS is...

  • Inspired by C-family syntax (more specifically ECMAScript)
  • Procedural
  • An interface to most .NET classes*
  • Dynamic

*: There is only limited support for generics and features not available through reflection.

PXS is not...

  • A replacement for any .NET language
  • Especially fast due to it's high level of abstraction
  • Safe**

**: The engine requires Reflection and IO permissions so malicious code can access most of the base class library.

PXS features...

  • Duck typing
  • Unlimited redefinition of symbols
  • Nested functions (closures)
  • Functions as first class objects (lambda expressions)
Although PXS may be inspired by C-family syntax it still is quite different. Look at this:
Prexonite Script:
  1. Name SampleCode;
  2. Description "Some sample code to show off";
  3. Author SealedSun;
  4.  
  5. Add System to Imports;
  6.  
  7. Entry start
  8.  
  9. function start
  10. {
  11.     //Define the variable num in the scope of "start"
  12.     var num;
  13.     //Define a nested function
  14.     function sayHello does
  15.         Console::WriteLine("Hello $num");
  16.    
  17.     //Call the function several times while altering the variable num
  18.     for(num = 0; num <5; i++)
  19.         sayHello;
  20. }

Lines 1-7 are meta statements. Some of those statements are pure decoration (Name, Description and Author) while others affect runtime behaviour (Entry and Imports).

The first statement in the function is a local variable declaration.

The next line is a nested function definition. Note that the nested function does not conatain its own definition of the variable i but instead uses the definition of the outer function.

Next is a conventional for-loop.

The last statement, the loop body, is a call to the nested function sayHello. Note that Prexonite Script does not force you to add empty parentheses. The syntax for getting function references would be "->sayHello".