Syntax

Basics

Statements

A gpss.py program contains a bunch of Statements that create a model. There is one Statement per line. For example:

GENERATE
QUEUE
ADVANCE
DEPART
TERMINATE

But this is no good — the Statements need Operands!

Operands

Most Statements will take Operands. These Operands appear directly after the Statement on the same line, separated from the Statement by whitespace. Individual Operands are separated with commas, with no whitespace in between.

Here’s an example of a really short Transaction program:

GENERATE    18,6
TERMINATE   1

In the example above, there are two Statements: GENERATE and TERMINATE. Both of these Statements have Operands: the GENERATE Block has an A Operand of 18 and a B Operand of 6. The GENERATE Block can take more Operands, but they’re optional, so if left out, default values are assumed. The TERMINATE Block has just one Operand specified, the A Operand, and its value is 1.

To skip over Operands (e.g. specifying A and C but not B), simply leave its spot blank, like so:

GENERATE    10,,50

The above specifies 10 as the A Operand and 50 as the C Operand, but it doesn’t specify the B Operand, making the B Operand assume its default value.

Comments

Comments in a gpss.py program are started with either a semicolon (;) or an asterisk (*). These can be placed anywhere, and everything that follows a comment character will be ignored by gpss.py.

; I'm a comment!
* I'm a comment too!

GENERATE    1   ; That GENERATE is a Statement, but I'm still a comment!
TERMINATE       * I'm also still a comment!

Labels

Labels can be declared in two ways:

Notes

Differences from original GPSS

gpss.py programs look very similar to what an original GPSS program would look like, but there are a few differences: