Language structure

PPL program starts with the declaration of external variables (see Variable declaration). These are the variables controlled by Main Engine (see Experiment Editor).

Example:

time tau, t90, t180, T1 %% Variable declaration int ph,rr %% Variable declaration

Legend: PPL keywords; PPL pulse commands; comments.

Variable declaration is followed by declaration of signals or input channels.

Example:

signal 'a', 'b'

Legend: PPL keywords; PPL pulse commands; comments.

The names of signals are arbitrary. Physical acquisition channels are assigned to signals in Experiment Editor. Signal names are used in detect command to define used acquisition channels and their acquisition coefficients.

Example:

signal 'first', 'second', 'third' detect '-first', '-second', '+third' %% Note acquisition coefficient (+1/-1) %% added to the signal names

Legend: PPL keywords; PPL pulse commands; comments.

The body of the PPL program consists of a declaration of internal variables, Array declarations ...

Example:

%% Phase cycles (selection of pulse pattern) newtau = tau - 500ns phase1 = [ 0, 1, 2, 3, 1, 0, 3, 2, 0, 1, 2, 3, 0, 1, 2, 3] phase2 = [ 2, 2, 1, 1, 3, 3, 0, 0, 0, 1, 2, 3, 1, 0, 3, 2]

Legend: PPL keywords; PPL pulse commands; comments.

... and pulse commands.

Example:

%% Detection sequence mwpulse t90, phase1(ph), 1 wait tau - (t90+t180)/2 mwpulse t180, phase2(ph) wait tau - t180/2 detect det1(ph), det2(ph)

Legend: PPL keywords; PPL pulse commands; comments.

Type Specifiers

External variable type specifiers.

Type Value example Description
bool true; false or a > 4 Boolean variables
int 1 Integer variables
real 12.4 Floating point variables
time 10us Time variables
phase 45deg Phase variables
frequency 10MHz Frequency variables

IMPORTANT: Units must not be space-separated from value.

Example:

time tau, t90, t180, T1 %% Variable declaration int ph,rr %% Variable declaration

Legend: PPL keywords; PPL pulse commands; comments.

Internal variable type is set by assignment.

Example:

newtau = tau - 200ns

Legend: PPL keywords; PPL pulse commands; comments.

Variable declaration

Syntax

direct declaration: <type-specifier> <declaration-list>

type-specifier: bool, int, real, time, signal

Example:

time tau %% declaration time t90, t180 %% declaration-list int ph %% declaration

Legend: PPL keywords; PPL pulse commands; comments.

declaration by assignment: variable-name = <expression>

Example:

tau = 10us T = tau - 2us

Legend: PPL keywords; PPL pulse commands; comments.

Description

There are two ways of variable declaration: direct and by assignment.
Variables declared in the direct way (exported) can be changed from outside of the PPL script and are visible in experiment interface.
Variables declared by assignment are visible only inside the PPL script. Type of the variable in this case is equal to the type of expression it is assigned to.

Array declaration

Syntax

variable-name = [<expression1>, <expression2>, ...]

PPL script allows declaration of 1-dimensional arrays of all available types. Declaration of array is made by assignment. All expressions in assignment has to be of the same type. Arrays cannot be addressed from outside of PPL script.

Arrays are 1-based (first index is 1).

Example:

phase = [0., 90., 180., 270.] %% real array with 4 elements t = [5ns, 65ns] %% time array with 2 elements det = [I, Q] %% signals' array det = [2*I, -2*Q] %% starting from ver. 2.5 signals' array with coefficients

Legend: PPL keywords; PPL pulse commands; comments.

Statements

PPL language supports the following statements:

  • Assignment statement
  • Example:

    tau = 10us

    Legend: PPL keywords; PPL pulse commands; comments.

  • Conditional statement if-else-end
  • Example:

    if T > 1us mwpulse 10us else wait 10us end

    Legend: PPL keywords; PPL pulse commands; comments.

  • Repeat statement repeat-end
  • Example:

    repeat 5 detect 'a' end

    Legend: PPL keywords; PPL pulse commands; comments.

  • Parallel execution statement parallel-end
  • Example:

    parallel mwpulse t90 end

    Legend: PPL keywords; PPL pulse commands; comments.

  • Wait statement wait
  • Example:

    wait T

    Legend: PPL keywords; PPL pulse commands; comments.

  • Detect statement detect
  • Example:

    detect 'a'

    Legend: PPL keywords; PPL pulse commands; comments.

Comments

Comments are pieces of text used to annotate a program. Comments are for the programmer's use only; they are stripped from the source text before parsing.

PPL allows a single-line comment using two adjacent percent signs (%%). The comment can start in any position, and extends until the next new line.

Example:

mwpulse 45ns %% Comment is started here

Legend: PPL keywords; PPL pulse commands; comments.

PPL also allows an inline comment enclosed in a pair of single percent signs (%…%). It ends at the closing percent sign, so the rest of the line is still part of the program. Inline comments may only contain letters, digits, spaces and underscores — no punctuation, and they cannot span more than one line.

Example:

mwpulse %first pulse% 45ns

Legend: PPL keywords; PPL pulse commands; comments.

The same two forms are accepted by the Console commands.

Whitespace

Whitespace is the collective name given to spaces (blanks), horizontal and vertical tabs, newline characters, and comments. Whitespace can serve to indicate where tokens start and end, but beyond this function, any surplus whitespace is discarded. For example, the two sequences below are lexically equivalent

Example:

time tau mwpulse 45ns

Legend: PPL keywords; PPL pulse commands; comments.

and

Example:

time tau mwpulse 45ns

Legend: PPL keywords; PPL pulse commands; comments.