Statements and Keywords

To produce more readable code, write PSL statements and keywords in lowercase.

Statement

Description

catch

Defines the code that will be executed to handle an exception thrown by the code following the statement.

do

Calls an object method or PSL subroutine or structured code block {}.

else

Executes statements when a condition is not met.

for

Repeatedly executes statements.

if

Executes statements when a condition is met.

set

Assigns a value to an object property or a variable.

throw

Throws an exception.

type

Declares (and instantiates) an object.

while

Repeatedly executes statements.

write

Writes a primitive data type to the current device.

quit

Quits from an object method, PSL subroutine, PSL function, or for loop.

 

Keyword

Description

literal

Used in a type statement to specify that the value of the primitive object is constant. When generating code, the PSL compiler substitutes references to the object by the value supplied in the type statement.

local

Reserved for future use to declare the accessibility of a PSL subroutine or PSL function. A PSL subroutine or PSL function that is declared local can be accessed only by subroutines and functions inside the current PSL module. The code generated by the compiler will prevent access to the subroutine or function by other PSL modules.

private

Declares the accessibility of a PSL subroutine or PSL function. A PSL subroutine or PSL function that is declared private can be accessed by a limited number of subroutines outside the current PSL module. This may affect the code that will be generated by the compiler.

public

Declares the accessibility of a local variable, a PSL subroutine or PSL function.

When the keyword public is added to a type statement, PSL assumes the scope of the variables in that type statement is managed outside the subroutine or function that accesses them.

When this keyword is prepended to a subroutine definition or a function definition, this signals that the subroutine or function can be accessed by any subroutine or function from any PSL module. Declaring a subroutine or function public may affect the code that will be generated by the compiler.

 

When a variable is declared public, it is the programmer's responsibility to ensure that the type is declared consistently across all subroutines and functions that access the variable.

The current version of the PSL compiler treats subroutines that are declared private exactly the same as those declared public. This is likely to change in a future version.

A subroutine that is declared neither private nor public is considered to be declared local. Since the code generated for local procedures may be different, calling such a subroutine or function may produce unpredictable results. A future version of the PSL compiler will prevent access by other PSL modules to code that is declared local.