Rochester Institute of Technology
RIT Scholar Works Theses
Thesis/Dissertation Collections
1984
GPSS Compiler/Simulator Jacquelyn Van Dellon
Follow this and additional works at: http://scholarworks.rit.edu/theses Recommended Citation Van Dellon, Jacquelyn, "GPSS Compiler/Simulator" (1984). Thesis. Rochester Institute of Technology. Accessed from
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
[email protected].
,. Preliminary Information.
,.,.
Title and Acceptance Page.
Rochester Institute of Technology School of Computer Science and Technology Thesis: GPSS Compiler/Simulator by Jacquelyn Van DeJlon A thesis, submitted to The Faculty of the School of Computer Science and Technology, in partial fulfillment of the requirements for the degree of Master of Science in Computer Science
Approved by : ...........................................................................,........................................................ . (James Carbin . committee head)
{Margaret Reek)
(Guy Johnson)
Title of Thesis:
J.~.t;.q ..~.~.~y.lI.
GPSS COMPILER/SIMULA TOR
~.t,.,..~~.f'l
I ........... ................v.I!tIA .... ...................................... hereby grant permission to the Wallace Memorial Library, of RIT, to reproduce my thesis in whole or in part. Any reproduction will not be for commercial use or profit.
(Jacquelyn Van De/ion)
DArl·l···IJ.~········
Table
1.2.
1.
of
Contents.
Preliminary Information. 1.1. 1.2. 1.3. 1.4. 1.5.
Title and Acceptance Page Table of Contents
3
Abstract Key Words
5 6
Phrases Computing Review Subject Codes and
2.
Introduction
3.
Functional Specification
4.
and
Background
15
Architectural Design. Parser and Symbol Table Design 4.2. Pseudo Code Generator Design 4.3. Simulator and Statistical Output
18 21
Interface Specification. External Interfaces 5.2. Internal Interfaces
23 23
5.1
6.
.
,
Module Designs. Processor Modules 6.2. Communications among Modules 6.1.
7.
8.
Verification and Validation. 7.1. Test plan. 7.1.1. Parser and Symbol Table 7.1.2. Pseudo Code Generator Simulator and Statistical Output 7.1.3. 7.2. Test Procedures. 7.2.1. Parser and Symbol Table 7.2.2. Pseudo Code Generator Simulator and Statistical Output 7.2.3. 7.3. Test Results. Parser and Symbol Table 7.3.1. 7.3.2. Pseudo Code Generator Simulator and Statistical Output 7.3.3. Conclusions. Problems Encountered and Solved Discrepancies and Shortcomings of the System 8.3. Lessons Learned. 8.3.1. Alternative Approaches for Improved System Suggestions for Future Extensions 8.3.2. 8.3.3. Related Thesis Topics for the Future
8.1. 8.2.
9.
7
9
4.1.
5.
1
Bibliography
10. Footnotes
17
25 25
27 31 31
38 38 38 39 82 159
181 181 181
182 182
183 185
11. Appendices. 11.1. Appendix 11.2. Appendix 11.3. Appendix 11.4. Appendix 11.5. Appendix
A B
C D E
11.6.
Appendix
F
11.7. 11.8.
Appendix Appendix
G H
-
-
-
-
-
-
BNF
grammar of GPSS language Individual parser test programs Traffic program to test statement interaction Error table for the GPSS parser Program to verify random number uniform distribution Command Definition File for GPSS command
line GPSS module interconnection GPSS internal architecture
12. Program Listings 12.1 Pass 1 and tools 12.2 Pass 2
12.3 12.4 13. User
13.1. 13.2. 13.3. 13.4.
Simulator and tools # include files and link file Manual. Introduction Control Statements
Block-Definition Statements Entity-Definition Statements
187 189 207 209
213 216 217 223
231 282 287
330
337
338 341 354
Abstract.
1.3.
As
any large software project, the first priority of this thesis is program the GPSS compiler and correct simulation statistics. Several distinct processes are gone through in the construction of any compiler/simulator: development of specifications, indication of the goals, design, implementation, evaluation, and maintenance. with
correctness
in
The specifications of the GPSS compiler/simulator were introduced in the thesis The VAX/VMS 11/750 will be the machine which this GPSS compiler/simulator uses because of the supported 'C language, a Command Language Definition Utility, and accessibility by this author. The implementation language, 'C, was chosen based on ease of proposal.
readability, ease and
the
of
understanding, the simple but powerful data structures in the language,
language's
support
of
modularization.
Three milestones were identified for this thesis project: the parser, the pseudo code generator, and the simulator. Many projects are started with only the end product in mind, but the goals which were identified constitute essential checkpoints to validate the integrity of the compiler/simulator. There were three distinct design phases due to the milestone identification. The design encompassed the initial modular design layout of the source code for the entire compiler, and the design of the symbol table. Design of the pseudo code language had two constraints imposed: the ease of representation of the GPSS language in twoaddress code and the ease of integration of the pseudo language into the parser. Last but by no means unimportant was the design of the simulator, which controls the order of events parser
within
a
model.
After each design phase described above was completed, the implementation or writing of the source code was accomplished. The parser, the pseudo code generator, and the simulator carried through the 'C capabilities of modularization and readability.
Evaluation of compiler at points: after the was accomplished three the implementation of the parser, after the implementation of the pseudo code generator, and after the implementation of the simulator. The milestones or checkpoints specified in the identification of goals were essential in verifying the integrity of the system. is not a part of this thesis, the design phase took into This adding functionality to the implemented subset of GPSS. compiler/simulator could be used as a base from which a more sophisticated and current version of the GPSS language would immerge. Although
consideration
maintenance
the ease
of
1.4.
Key Words
Phrases.
and
BDT
block
current events
the events chain a transaction is linked time equals the current clock time
chain
discrete simulation language
-
language
a
the events chain
which
-
can
symbol
tables,
chain
errors
a
Purpose Discrete System
GPDS
XEROX General
GPSS
General
one-pass compiler
fully
pseudo code
intermediate language
Purpose Simulation System the
generates
number
code
object
which
to
the source
produce
simulation
second pass
creates
two-address code
intermediate language
fully
one
scan
of
the source
usually consists of a relatively small to form a list semantically 1
program
schedules routines/functions
operator,
after
of simple operations combined
equivalent
compiler
complex
an associated
current
\wo-pass
of
occurring ait the same time
transaction is linked when the transaction BDT (block departure time) greater than the block time
the events
to
network
a
block departure
creates skeleton pseudo code, and parses
for language
program
has
scheduler
represent
of which are
when
step function
builds
pass
future
time
interactions, many
discrete function
first
a
departure
pseudo
and
generates
code
two
to
run
in
a specified sequential order
results
for the
scheduler
representation
which
consists
of
an
operands
the object code
after
two scans
of
the source
1.5.
Computing
Primary Code:
Secondary Codes:
Review
D.3.4
I.6
Subject
Codes.
Processors Parser, Pseudo Code Generator,
Simulation
Concepts
and
and
and
Simulator
Modeling
understanding
of
the GPSS language and uses
E.2
Data Storage Representation Binary tree structure for the symbol table One way linked list for the pseudo code Linked list for the future events chain
D.3.1
Formal Definitions and Theory Break down of the GPSS subset into BNF representation Requirements for implementing the GPSS compiler/simulator Test criteria
2.
Introduction
Background.
and
The following pages describe the process which was taken in the design and implementation of this GPSS compiler/simulator. Although the main consideration of this project was to deliver an efficient, well designed software package, the project's emphasis is on the pseudo code generator and its integration into the parser.
Geoffrey Gordon, an employee of IBM, developed the General Purpose System Simulator, GPSS, and presented the concept in two papers: "A General Purpose Systems in 1961, and "A General Purpose Digital Simulator and Examples of its Simulator"
Applications: Part I
Description
-
of
the
computers were the machines on which
the
"Gordon
tool
which could
Simulator",
Systems
Simulation, the
Simulator"
in 1962. The IBM 704, 709, and 7090 the first release of the GPSS language, often called
implemented.
was
early 60's had come to realize simulation was a valuable to analyze the performance of proposed systems configurations. properly used, could provide valuable information by showing in some detail how engineers of the
components
The
be
used
of
a
system
were
to
expected
behave.^
preparing a computer simulation in the early 1960's fell into two the system had to be constructed and second, a computer program "run" had to be written to effectively the structured model. The process was simplified by the introduction of the GPSS language. No longer were long programs required for each model. All the engineer had to do was to describe his problem in terms of the GPSS language and then let the GPSS simulator model the system. tasks:
problem
first,
of
a model of
The language define be for
certain
basic
was not
designed for any
applied to a wide variety of systems
particular class of systems.
The
aim was
to
actions which were characteristic of systems so that the program could
engineers
flowcharts to describe
who
different
were
systems
applications.^
not specialists
known
in
computer
The language programming.
was
targeted
The
use
of
this time, and so GPSS was structured as a block-oriented language. This philosophy allowed the analyst to describe the system as a connected network of block diagrams representing the sequence of events. a system was well
at
A set of 25 specific block types was defined for the first implementation of GPSS. Each block represented a basic system action and had an associated time to perform this action. The system was described in terms of a combination of blocks which could be used General units of traffic in the system were represented by transactions, which repeatedly. The transaction or basic unit were defined to model the dynamic components of a system. of GPSS could vary in nature, depending on the system. For example, in a traffic model the units might be cars, or in a grocery store simulation the units might be people, or in a The transactions moved through the communication system the units might be packets. simulation
under
the
control
of
the blocks and were created and destroyed as
required.4
concepts of block-diagram structure and transactions were retained in 1964, and all functions performed by the earlier program could also GPSS II. A summary of improvements were:
The fundamental in GPSS
be
II,
released
performed
by
*
A greater ability to sense the current state of the system, and to implement permitted FORTRAN-like decisions based upon this state. "VARIABLE algebraic computations using system variables. Those capabilities provided improved control over the flow of transactions in response to the current state of the system. statements"
*
The ability to associate a greater the form of eight parameters.
amount of
information
with-
each
transaction in
*
The introduction of an indirect specification feature which permitted a transaction to specify from its parameters the characteristics of the block entered, rather than requiring these characteristics be fixed for an entire simulation. This feature added flexibility and made it possible to reduce the size of certain types of models. *
a
The
generalization of
greater
number
of
GPSS functions to
data points for
permit a wider
inserting
of arguments and
variety
data descriptive
of
the
system.
An optional assembly feature which simplified the description of the block diagram by furnishing the block numbers from symbolic names, and which enabled the program to set up and call "block macros". These macros were user-defined segments of a block diagram which could be used repetitively within a model, with the block characteristics varied as desired. *
*
The ability to
by
the
*
Expanded
*
Generally faster
into FAP (FORTRAN
go
application
program)
subroutines prepared
user.
output
statistics
and
information.
error
5 execution.
GPSS III, released in 1965, was extended for use on the IBM 7040 and 7044. Several distinct advantages, brought about by a major language design, were seen in this new version. Time delays, which were previously incorporated into every block, were eliminated Selection factors were also removed and replaced by a single block, called an ADVANCE. from all blocks and replaced by the TRANSFER block. These changes redefined the whole block structure but made the conceptual understanding much easier. A summary of other changes to GPSS III are listed below. *
Increased the
speed
Gave the
the capability
user
of
the
simulator
of
due to the language
choosing
a variable
redesign.
number of
parameters
per
transaction. *
Storage flexibility core
reapportion
*
The
introduction
independent
of
automatic space
storage
of
without
user
the standard
of
going
chains,
reallocation, gave the through a reassembly
allowed
users
to
user
create
Current Events, Future Events,
or
the ability to
phase.
their
own
Interrupt
chains chains.
*
The new Attribute Valued function allowed the use of any Standard Numerical Attribute in the specification of a function point where previously only constants could *
appear.
Increased
which
printed
Numerical *
The
debugging out
The
addition
of
the DEPART
This
was
block,
done in
the function of the QUEUE block into to get better statistics from the QUEUE
split order
of two new features to the SPLIT block: the ability to specify the transactions to be split, and the ability to serially copy transactions in a
addition
number of
specified parameter
Events
The START card had the snapshot feature added, The new block, PRINT, could print any Standard
Attribute.
two separate blocks. block. *
tools.
statistics.
chain
until
.
GATHER, the
count
a new
block,
specified
10
is
removes
reached.
transactions from the Current
The HELP block
include
to
extended
was
addressing.
symbolic
*
The addition of a new function, List, required the independent argument values of the function be sequential integers beginning with 1. This feature allowed the function to be evaluated more quickly than a comparable discrete function and, since arguments *
The
were
not
addition of
to
subroutines
be
also
stored,
saved
core.
the subroutine mode to the TRANSFER block allowed called and returned the user to the proper block.
specified
*
The addition of two new blocks, EXECUTE and CHANGE, increased the GPSS flexibility. The EXECUTE block allowed the entering transaction to perform the operation of any other specified block without diverting the transaction from its normal sequential flow. The CHANGE block allowed the user to modify the model during the course of a simulation by changing any one block to a duplicate of any other
The basic releases
block.
structure of the
are
GPSS/360, OS/360
and
language has
remained unaltered since
GPSS III
and all
further
upward-compatible.^
announced
DOS/360.
in 1967,
The
because it could operate to the language were:
changes
*
The addition of signed halfword increased the range of the quantity in a were considered to be positive.
and
fullword
parameter.
parameters
IBM's
under
was more versatile
major
and
Prior to GPSS/360
savevalues parameters
*
Additional Standard Numerical Attributes were added increasing the versatility of simulator. The new Standard Numerical Attributes were: the priority of a for utilization number of and entries facilities and the storage, and other transaction, statistics relating to table, facilities, queues, and user chains. the
*
The
status meet
new
a
specified of
number
*
blocks, COUNT
and SELECT, provided the user with the means to The COUNT block determines the number of entities that condition within a range. The SELECT block determines the
multiple entities.
an
entity that
The group entity
a
meets
allowed
the
specified
to
user
condition
associate
within
a
range.
transactions
based
like
on
attributes.
*
of
Matrix
savevalues allowed
storage
main
the
user
to
access and
define
a two-dimensional
array
locations.
*
The operation of the PREEMPT now takes into consideration the priority of the GPSS/360 allows a transaction to have a priority from 1-127. transaction; *
Eight
random number generators gave
numbers. number
in
Parametric certain
the ability to assured that progress
of
* Boolean language.
*
studies often
paths of a model
the users independent sources
delays based be identical from run to run. The require that specific
reference unique random-number generators
changes
in
transactions
other
in
variables
were
Macro instructions
were
the
parts
of
desired
the
model
will
in
not
affect
has be
the consistent
paths.
introduced, thus helping the
11
user now
such paths and can
introduced, thus increasing the logical
code.
of random
on a random
power
of
the
modeler reduce redundant
*
The HELP block language programs. *
was
introduced allowing the
analyst an
interface to
assembly
editor and the capability of producing histograms was supplied departure from the standard output. The new capabilities analyst a the allowing helped to extend the outputs readability and give a more meaningful report for later
An
output
use.
Two additional releases have since been made, a second version of GPSS/360 and GPSS V. These changes were directed mainly to simplify the routine tasks of modeling and A run timer can be set to limit the total to relax restrictions on the size of the models. run expires before the end of simulation, output When time used. execution computer time is produced and the simulation run is terminated. The HELP block has been extended so that the analyst has a simple interface to the power of FORTRAN or PL/I. Free-form coding the labor of program flexible data handling within reduces
with
associated
each
preparation.
the
transaction
model,
has
New types of parameters and arrays give more the number of parameters that can be
and
been
increased
significantly.10
The history, given above, shows a logical progression of the GPSS language development over the years. The choice of a GPSS subset for this thesis implementation Three questions was based on the history of the language and the needs of the user. 1. How many GPSS instructions were implemented for the initial needed to be answered: 2. Since only the standardized report was to be allowed, what release of the language? instructions had to be included to gather the specific statistics? 3. What GPSS instructions were needed to give the modeler flexibility? first version of GPSS. The assumption was that instructions would give the analyst using the thesis GPSS version reasonable modeling capabilities. Three divisions of the GPSS language, Control Definition Block Definition Statements, were examined, and Statements, Entity Statements, and a selection process was undertaken. The following paragraphs describe the subset chosen, where the GPSS subset roughly corresponds to an implementation of GPSS III.
Twenty-five instructions
approximately the
made up the
same number of
Within the Control Statements, the END, SIMULATE, and START statements were The END and SIMULATE were chosen for compatibility to previous versions of the language. The input medium in the early 1960's was computer cards and the END statement served as the termination card for the program. Since file processing is the chosen medium for this thesis, clearly this instruction is not required. The SIMULATE statement signifies that the program should be parsed and simulated; if the statement was not included in the program only the parsing phase would occur. The command line could include the required qualifier to perform the SIMULATE instruction. The START statement marked the beginning chosen.
of
the
simulation phase and specified
The thesis START and
an
optional
the
termination count
run
when
the
model should end.
card specifies the run termination count, an optional switch
operand
which
specifies
snap
interval
printout
of
for output,
statistics.
Entity Definition Statements define
permanent entities of the model. The FUNCTION included because it allows the modeler to specify data as x and y coordinates. Only the discrete function was implemented for the thesis; GPSS V has the capability of five functions continuous, discrete, discrete attribute valued, list, and list attribute valued. The VARIABLE statement allows for arithmetic computations within the model framework. The STORAGE statement was included as one of the required statements for the standardized output.
statement
was
Block Definition Statements form the logical network of the model. The TERMINATE are the most important GPSS instructions. The GENERATE transaction which enters the model and the TERMINATE destroys the creates the transaction. The ADVANCE block gives the analyst the capability of modifying the
The
GENERATE
and
12
The ASSIGN transaction for a specified amount of time. to arithmetically modify one of the ten parameters which are logically connected to the transaction. The GATE, TRANSFER, and TEST instructions were included to give the ability of moving in a nonsequential mode through the model. The QUEUE, DEPART, ENTER, LEAVE, SEIZE, and RELEASE were all instructions needed to generate the standard statistical output.
simulation
clock;
delaying
instruction allows the
Listed below is respective
a
modeler
a
implemented
summary
version
GPSS
of
of the GPSS.
chosen
subset
GPSS
statement
of
GPSS statements,
implemented
and
the
version
CONTROL STATEMENT: END START
GPSS 1 GPSS 1 GPSS III
FUNCTION STORAGE VARIABLE
GPSS GPSS GPSS
1 1 II
ADVANCE ASSIGN DEPART ENTER
GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS GPSS
III III III III III III III III III III III III III
SIMULATE
ENTITY
DEFINITION STATEMENT:
BLOCK
DEFINITION STATEMENT:
GATE GENERATE LEAVE QUEUE RELEASE SEIZE TERMINATE TEST TRANSFER
The following subset
of
nineteen
paragraphs statements
describe further rules and restrictions applied to the GPSS for the thesis implementation:
chosen
Each transaction has ten parameters. The GPSS programmer does not have the capability to specify the number of parameters per transaction, an Each parameter is a thirty-two bit integer, option introduced in GPSS III. with a range from 2,147,483,647 to -2,147,483,648. Four
Standard
statement of a
the
Numerical
GPSS
program:
Attributes are allowed within a block the function, the variable, the parameter, and
storage.
Free form input has been implemented which The impact to the programmer is there are No
user
same
formatting
constraints
as
of
the
simulation
GPSS III.
13
was
no
statistical
first
seen
in GPSS V.
column
restrictions.
output
is allowed, the
14
3.
Functional Specification.
The purpose of this thesis is to take a GPSS program using the subset of nineteen block statements described in section 2. Introduction and Background on page 9, and parse the program for grammatical errors, compile the program, and output a standard statistical report.
The parsing
from left to right checking for syntax the GPSS language found in Appendix A, page 187. Errors are flagged with an '*' and the appropriate error message is output if the label definition is incorrect, if the keyword definition is incorrect, if the mnemonic specification of a comparison is not valid, if the specification of the operands is incorrect, if the correct standard numerical attributes are not specified correctly per the keyword found on the line, and if extraneous information is found at the end of the instruction. errors per the
The
stage of the BNF specification
compilation
simulation usable
follow the
form;
mapping
compiler will parse of
of
the
an
intermediate coding
algorithm
program
shown
consists
on
of
converting the GPSS
stage.
page
This
program
pseudo code generation
into a has to
20.
The pseudo code generated, from the compilation phase, is used to form the GPSS GPSS chains, both the Current and Future Events Chains, are lists of events occurring in the model currently and in the future. The simulation phase gathers statistics chains.
on
the chains
and
then
outputs
the
standard
15
statistical
report.
16
4.
Architectural
4.1.
Parser
Design.
and
Symbol
Table
Design.
The first step, in designing the parser, was to break down the language into its basic components, in order to aid in the decision of utilities and the design of essential modules of code. A top down design approach was chosen, therefore the User's Manual for the GPSS language language
Then to facilitate the breakdown of the grammar into units, the GPSS to contain no ambiguity. The Backus-Naur notation was chosen to represent the definition of the language syntax. Appendix A on page 187 contains the BNF representation which was created for this thesis. was written.
was assumed
Using the syntactic definitions in Appendix A, the software utilities implemented were: parsing for a correct label, parsing for an integer number, parsing for a floating point number, parsing for an implemented standard numerical attribute, parsing for statement keywords, getting a word, processing errors, and building a symbol table. The is
package
pass one
code
compiler/simulator modularized.
( the
Pass
parser and
),
creation
and
was
There is
the
the
designed in
three segments,
therefore the software
a controlling, main routine which monitors the
skeleton
running
of
pseudo code generator
the
),
pass two
running
( finish
of
pseudo
simulator.
has a controlling, main routine which gets a line of source code, and to the correct parsing function for the statement. The parsing of the keyword is also implemented in modules, therefore allowing simple, quick additions of statements, and one
passes control
options.
The design of the symbol table had three phases, understanding the purpose of the table, understanding what information needed to be in the symbol table, and the method of accessing the data.
symbol
for a symbol table, listed in the literature read: to relate a to where it is used in the program, to define the data type, and to make the internal program more concise by placing an indicator in the internal program pointing to the
There
name
are three purposes
(variable)
The thesis symbol table defines the data attribute, contains all attribute table information assigned to the symbol, for example FUNCTION x and y data points, and makes the intermediate code more concise because the operands for each pseudo code instruction are pointers to the symbol table definitions. entry.6
symbol
There are five capabilities a symbol table should have per the literature read: to determine whether a given name is in the symbol table, to add a new name to the table, to access information in the table, to add new information in the table for a given name, and to The thesis program tool/function group of names from a given table. new can add symbols to the table and can search the symbol table which deals the table for a specific symbol, to determine if the symbol has been defined or to access needed information. delete
a name or with
The binary tree structure was chosen for the accessing method into the symbol table. GPSS is a simply structured language and the retrieval of information from the table was not viewed as a
bottleneck
of
the
speed of the hash approach
or the pseudo code generator. Thus, the increased the complexity of implementing such a scheme was not
parser
and
justified. The implementation language of C strongly influenced the choice of the binary tree due to the ease of link representation. The following describes the main structure
structure of
the
binary
tree:
17
struct
SYM-TABLE
{ *label
char
; *attr_pnt
LAB
struct struct struct
SYM-TABLE*
right
SYM-TABLE *left
;
; ;
} The links to the lower levels The pointers make effective
of
the
binary tree,
right and
left,
are represented as pointers.
the compilers memory space. The label variable is a pointer to the ASCII representation of the symbol again making effective use of memory space. The label is the search field through the binary tree. The attr_pnt points to the associated label attributes. use of
The label attribute structure, LAB, was designed to retain the GPSS context for each label contained in the tree. Again, the C language strongly influenced the structure created for retaining this information. struct
i
LAB
{ int int int int double
lab_attribute leng_info ; *pnt_info ; func_spec ; *flo_num ;
} defines the
lab_attribute
label
STORAGE,
attribute:
LABEL,
VARIABLE,
FUNCTION,
CONSTANT. The actual label information is pointed to by pntjnfo and the length of that information is specified by lengjnfo. func spec defines the type of function. Although, the discrete function only is implemented in this version of GPSS, the variable was included for expansion purposes. The y data of a FUNCTION statement is contained in the flo_num. The C structure allows effective use of
PARAMETER, TEMPORARY VARIABLE,
the
4.2.
compilers
memory
Pseudo
management
or
space.
Code Generator.
Intermediate languages can be in many forms: postfix, prefix, triples, and quadruples. Most intermediate languages are devised for code optimization. In designing the pseudo code generator, triples and quadruples were investigated.
Triples, The
results of
or two-address code, contain three fields: an operator, and two operands. the triple operation is referred to in the program by the number of the two-
address code statement. The concept of indirect triples is a list of pointers to the actual two-address code statements. When pseudo code is being optimized, indirect triples allow a quick way to change the order of the code with out having to relocate the actual triples.
Quadruples, three-address
code,
on
The three operands are the two last operand is for storing the result of the
operands.
program
or
variable
Operations arithmetic conditional
program
which
can
generated
the
unconditional,
hand have:
an
being
operation. Three-address temporary locations.
be represented
operator and
three
operated on and the code results
may be
by quadruples and triples are: math and indexing, comparisons, logical operations, branches, begin or end block, and allocation of array storage.
functions, assignments, and
other
variables which are
18
In general a compiler is described as pass, syntactic analysis, and code
up into three phases: the lexical The lexical pass phase scans an input string, the input string. The syntactic analyzer takes
being broken
generation.
detects markers and key words, and reduces the inputted lexical string and outputs a tree structure division of verb, subject, and completes the symbol table. Code generation converts the syntactic analysis to a local form. It is common to combine the lexical and the syntactic analysis pass. The two-address language for this thesis.
for the intermediate this selection was the wide range of operations which could be produced by using triples. Not only was this suitable for the subset of the language implemented but this allows for the expansion of the GPSS options at a later date. Another reason the language was suited to the two-address code structure was the GPSS operand specifications for each block statement; a minimum of no operands to a maximum of three operands per statement. Please refer to chapter 14, the User Manual, for an in-depth look at the syntax for the block statements. After reading compiler and
its
code or triples representation was the choice
One
research
of
the
major advantages of
described the IBM OS/360 H FORTRAN IV (three-address format) and
materials which
use of the second phase
to
create quadruples
Control Data Corporation's FORTRAN extended compiler use of pass one to create a symbol table while generating an intermediate form of code, the decision was made to redesign the first pass of the compiler, the parser. It was clear, because of the examples of the IBM and Control Data Corporation's FORTRAN compiler, several operations could be combined into one pass of the code. The skeleton of the GPSS pseudo code could be generated in the first pass of the compiler, therefore optimizing the number of passes being made through the program.
The label statements
second
which
pass would
of
required
be
used
completion
not
used
utilLe
after
for
this
the pseudo code structure. GATE block were the only block first pass of the compiler.
only to
TEST, TRANSFER,
the
Although the code is implementations could
future
code
The
addresses
the
complete
and
optimization
purposes
in this
version
of
GPSS,
facility.
The implementation language of C strongly influenced the choice of the intermediate The C structure designed to represent the pseudo code is shown
representation.
below: struct
CODE
{ int int SYM-TABLE SYM-TABLE struct CODE
block operator
*A_operand *B_operand *code_link
}; The pseudo code structure is an effective use of the because of the use of the operand pointers into the
memory management space Operator is an integer The Aoperand and Boperand are
compilers
symbol table.
the thirteen block statements. representations of the parameter, variable, function, storage, or table pointers to the constant used in the block statement. This tightly linked relation between the symbol table representation of one of symbol
and the pseudo code representation avoids redundancy of an integer between 0 and the total number of blocks and code
link
is
a
pointer
to the
next
pseudo
19
code
information used for
is
structure.
stored.
The block is The
offset purposes.
The list below describes the mapping into two-address
algorithm
from the block definition
statements
code.
Comment
Statement
Operator
A-operand
B-operand
ADVANCE
advance
A-operand
NULL
ASSIGN
neg
A-operand
B-operand
assign
A-operand
B-operand
DEPART
depart
A-operand
B-operand
ENTER
enter
A-operand
B-operand
GENERATE
generate
A-operand
B-operand
GATE
u
A-operand
NULL
one
nu
A-operand
NULL
listed:
sf
se
A-operand A-operand
snf
A-operand
sne
A-operand
NULL NULL NULL NULL
bne
A-operand
NULL
LEAVE
leave
A-operand
B-operand
QUEUE
queue
A-operand
B-operand
RELEASE
release
A-operand
NULL
SEIZE
seize
A-operand
NULL
TRANSFER
br
NULL
B-operand
unconditional
TEST
eq It
B-operand B-operand B-operand
one of
gt
A-operand A-operand A-operand
bne
A-operand
NULL
with a
terminate
A-operand
NULL
TERMINATE
20
if B-operand
of
minus
the qualifiers
u, nu, sf, se, snf, or sne is one of a pair
of statements
a pair of statements
branch
the qualifiers listed: eq, It, or gt is a statement along
bne statement
Simulator.
4.3.
One of the tools needed to implement the simulator was a random number generator. A VAX/VMS C random number utility was available, but had to meet a certain set of guidelines in order to be used in the simulator. An important factor to be considered was the period of repetition of the random number. The period was determined to be acceptable at
Op
Another factor to be considered, in the GPSS application, was the number be between 0.0 inclusive and 1.0 exclusive. The random number was
2*.
generated should
between 0 and
23
but
function
to the appropriate had to be evenly distributed. The C utility provided no way to pick a variable number of seeds thus one seed had to provide the stream of random numbers to be used in the simulator. A test program, contained in Appendix E on page 213, verified a uniform distribution choosing every fifth number for a 10,000 number range.
-1,
Last but
not
a
least, the
was created to convert the number
random numbers
sampling.
To design the simulator, the chain concept of the GPSS language was researched. Due to the subset of the language chosen, the only two chains necessary would be the Current and Future Events chains. The Future Events chain is a list of transactions whose block departure times (BDT) are greater than the absolute clock. The transactions are sorted on the chain by the block departure time. For this thesis application, the Future Events chain was used for the ADVANCE and GENERATE statements because these blocks were the only ones with associated block departure times. The Current Events chain, which is also a list of transactions, is not sorted. The Current Events chain is serviced on a firstA priority scheme can also be attached to the Current Events come first-served basis. servicing. The decision was made that none of the blocks had priority over the other therefore the current events chain is serviced these two chains interact is given below.
with one sequential pass.
An
example of
how
simulation begins by searching the pseudo code for all GENERATE statements. A transaction is generated for each statement found and the transaction is placed on Each transaction on the Future Events chain has an the Future Events chain. The block departure time indicates when associated block departure time (BDT). In the next step, the simulator transaction will be scheduled to enter the model. checks the BDT of the transaction on the top of the ordered Future Events chain and The transaction is then changes the simulation clock to correspond to this time. transferred from the Future to the Current Events chain. Another transaction is then generated for the transferred GENERATE statement and placed on the Future Events chain. The simulator then processes the transaction through the GPSS blocks until it An ADVANCE or SEIZE block are an example of a block can't move any further. The next which causes a transaction to be unable to move to the next logical block. consecutive transaction in the Current Events chain is processed through the model until it can't move any further. Finally, when all transactions in the Current Events chain have been processed, the simulator returns to the Future Events chain and starts the circular process of transferring a transaction onto the Current Events chain. It should be noted the only block statement which can cause a transaction to The move from the Current to the Future Events chain is the ADVANCE statement. ADVANCE statement delays the transaction by a specified amount of time, the delay is considered a BDT thus the logical association to the Future Events chain.
The
The C structure designed to Current Events chain. struct
represent
EVENTS
{ struct struct
EVENTS *for_link ; EVENTS *bck link ;
21
the transaction is used
by both
the Future and
CODE int int FAC STATS int QUE STATS int
*cur block BDT ; truth_bit ;
struct
STOR_STATS int int int
*ptr_fac time_sez *ptr_que time_que *ptr_stor time_stor blk_from
;
; ; ;
; ; ;
param[10]
;
j>
description of the transaction the memory management space within the Future and Current Events chain. The forlink and bcklink are the pointers which create cur block points the double linked list structure for the Current and Future Events chains, to the current pseudo code statement, block, the transaction is executing. BDT, the block
The
powerful
information,
data
and
structure
allows
capability
precise
of
control
C
allows a concise
over
departure time, is only used by the Future Events chain. The truth_bit, use only by the Current Events chain, is used to hold the YES/NO answer from the pseudo code comparison statements EQ, LT, GT, U, NU, SF, SNF, SE, and SNE. ptr_fac, ptrque, and ptr_stor are pointers to the statistics area for the model. time_sez, timeque, timestor are simulation times when the transaction has entered the SEIZE, QUEUE, or ENTER block respectively. blk_from holds the number of the last block statement executed. Each transaction has ten arithmetic
parameters
associated,
param[10].
22
5.
Interface Specifications.
5.1.
External Interfaces.
The authorized
$
command user
gpss
line,
which enters
interface.
The format
the GPSS program into the simulator, is the only of the command is:
filename. extension
No keyboard entry is allowed to interrupt the simulation once the command line is entered. If a cntrl Y is issued the simulation will terminate. No interactive debugging is allowed in this version of GPSS.
5.2.
Internal
Interfaces.
The main process of the compiler interfaces with the VMS Command Language Definition Utility. A Command Definition File was created which defines the command line, please refer to Appendix F, on page 216, for the command definition. Through the use of the VMS utilities, interpretation of the command line is extremely easy. Also, this facility allows easy addition of new parameters and qualifiers on the command line. Described in Appendix H, on page 223, is the internal architecture of the symbol table, the pseudo code, the block statistics, the facility statistics, the queue statistics, and the storage statistics. The diagrams which describe these entities are in block form which are in one-to-one correspondence with the associated C structure. The C data structures are the key to transferring and retaining information within the internal structure of the GPSS compiler.
23
24
6.
Module Design.
Processor Modules.
6.1.
The on
page
following
217,
is
gives
Appendix
description of the GPSS compiler/simulator. description of the following paragraphs.
a verbal
a
chart
There exists one has completed,
compiler
process, which determines whether each if the completion state allows further execution
master
and
G,
of the the GPSS
stage of
program.
each
Three divisions of the GPSS has a controlling process.
compiler/simulator exist under
the
master
process, and
The controlling process for the parser function manages the reading of individual lines of code and determines the keyword content. Once, the keyword is determined control is given to a specific parsing routine to complete language analysis and build a skeleton pseudo code representation. These analysis routines control additions to the symbol table and the printing of messages for the syntax errors detected. The second pass of the GPSS compiler has a controlling process which reads down the linked list of pseudo code for holes. Holes are operands whose label was not defined at the time of pseudo code generation. The correct address of the referenced label is then inserted into the operand field after location in the symbol table. The second pass of the GPSS
compiler
is
required
only for the TEST,
TRANSFER,
and
GATE
statements.
The controlling process for the simulation phase manages the initial generation of transactions and the transferring of transactions from the Future to the Current Events chain. Once, the Current events chain has been entered, each transaction steps through the pseudo code. A function in the simulator is executed for each pseudo code statement. This process is continued until the run termination count has been reached and then the statistical report is printed. The snap interval printout of the statistical report is also controlled
6.2.
by
the
main
process
Communications
of
among
the
simulator.
Modules
The controlling processes, described in section 6. 7 Processor Modules, page 25, are entity and when each phase has been completed passes along the symbol table address to the next phase. Program tools, because of their nature, have information each a separate
to them through function arguments; results are then returned by the way of the RETURN() statement. In general, most other communication is done through the use of Listed below is a list of the global definitions used through out the GPSS global definitions. passed
compiler.
Defined
in the
input,
main
source
controlling
program,
file
process:
pointer
line number of the source program block number in the GPSS program buffer location for the source line beginning pointer of the word being processed end pointer of the word being processed switch, YES/NO, for a SIMULATE statement was encountered switch, YES/NO, for an END statement was encountered total model
number
start
of
syntax
errors
information
25
number
of
start
number
of
temporary labels
first last
statement
of
statement
of
cards
the pseudo code the pseudo code
Defined in the controlling switch, YES/NO, has pointer
to the
process a
current
label
label's
for been
found
symbol
Defined in
the function which processes the temporary variable name
Defined in the controlling
table a
on
the
source
absolute
switch,
clock
YES/NO,
snap interval
snap
print
out
interval
print
time
26
line
entry
VARIABLE
statement:
process for the simulation phase: to the block statistics pointer to the storage statistics pointer to the queue statistics pointer to the facility statistics pointer to the Future Events chain pointer to the beginning of the Current Events chain pointer to the end of the Current Events chain
pointer
-
1:
pass
7.
Verification
7.1.
is
Test
Validation.
and
Plan.
Program correctness is an ambiguous term. Literature indicates testing of a program difficult and sometimes time consuming procedure. code correctness is a
a
bigger obstacle
Proving
the programmer has to verify his or her own program. The role of designer, programmer, and tester imbeds program functionality biases. Thus, some of the obvious tests will be overlooked due to false assumptions. The rules which were used to verify the GPSS compiler/simulator correctness were key points made in the literature read: 1. Test each field in a statement with the entire spectrum of permutations, 2. Test when
interrelationships
of statements.
may be
combined problems all
Bugs
possible.
7.1.1. Parser All
The
tools
program
being
nineteen
A GPSS
Control
of
level
Table.
used
in the
combined
module, such as GETWORD, were tested the main program interface for PASS 1.
parser
with
implemented in this project were tested separately and devised to test each each keyword statement, this included Refer to Appendix B, page 189, for the test programs. Below is a
statements
each
of
the
nineteen
test
programs.
Statements:
SIMULATE Test program's function:
Permutations START Test
separately may not produce an error but 3. The functions should be tested singularly, if at are easier to find. statement
program was
operand permutations. summarization
low
a
Symbol
and
separately before
combined.
on
Each
encountered.
not tested:
program's
Permutations
function:
not tested:
No operands allowed for a SIMULATE statement. Two SIMULATE statements encountered. No label allowed. Extraneous information found at the end of the statement. Presence of control characters.
No label
allowed.
Illegal A-operand. Required A-operand missing. Illegal B-operand, illegal mnemonic specification. Illegal C-operand. Extraneous information found at the end of the statement. Presence of control characters.
END
Test
program's
Permutations
function:
not tested:
No operands allowed for an END Two END statements encountered. No label allowed. Extraneous information found at the Presence of control characters.
27
statement.
end of the statement.
Entity Definition Statements: FUNCTION Test program's function:
Permutations
not
tested:
STORAGE Test program's function:
Permutations
not
tested:
VARIABLE Test program's function:
Invalid label. Incorrect specification of the random number. Incorrect discrete function specification. Correct function label, incorrect FUNCTION keyword. X data not floating point. Y data not integer. Extraneous information found at the end Presence of control characters. No label specified for the FUNCTION Duplicate FUNCTION label.
No label specified for the STORAGE Invalid label. Duplicate STORAGE label. Illegal A-operand. Required A-operand missing. Extraneous information found at the Presence of control characters.
of
the
statement.
statement.
statement.
end of
the
statement.
No label specified for the VARIABLE statement. Cannot use line defined variable in the variable statement. Checked for correct variables within the arithmetic statements: SNA (Standard Numerical Attributes), number (0 through 9). If the variable in the expression was an S.MA, the SNA was checked to make sure it was previously defined.
Checked for
correct
arithmetic
expressions:
[-]operand operator [-Joperand / exp operator where the operand is a valid variable and the operator is + -, *, or /. Checked for undefined SNA. Extraneous information found at the end of the statement. exp-.-.
=
,
Permutations
Block
not tested:
Definition
Presence of Invalid label.
control
characters.
Statements:
ADVANCE
Test
program's
Permutations
function:
not tested:
Illegal
A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Extraneous information found at the end Presence of control characters. Invalid label. Checked for undefined SNA. Checked for multiple labels.
28
context. of
the statement.
ASSIGN
Test
program's
Permutations
function:
not tested:
Illegal
A-operand.
Required A-operand missing. Checked for correct A-operand, SNA, Illegal B-operand. Invalid B-operand arithmetic operation. Checked for correct B-operand, SNA, Checked for undefined SNA. Extraneous information found at the end Presence of control characters. Invalid
context.
context.
of
the
statement.
label.
Checked for
multiple
labels.
DEPART
Test
program's
Permutations
function:
not
tested:
Illegal
A-operand.
Required A-operand missing. Checked for correct A-operand, SNA, Illegal B-operand. Checked for correct B-operand, SNA, Checked for undefined SNA. Extraneous information found at the end Presence of control characters. Invalid label. Checked for multiple labels.
context.
context.
of
the statement.
ENTER
Test
program's
Permutations
GATE Test
not
program's
Permutations
function:
tested:
function:
not tested:
Illegal A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Illegal B-operand. Checked for correct B-operand, SNA, Checked for undefined SNA. Checked for multiple labels. Extraneous information found at the end Presence of control characters. Invalid label.
Illegal Illegal
context.
context.
of
the statement.
A-operand. B-operand. for Checked correct B-operand, SNA, context in comparison to the A-operand mnemonic. Illegal C-operand. Presence of control characters. Invalid label. Checked for multiple labels. Checked line for A-operand and NO optional B-operand. Required A-operand missing. Required B-operand missing. Extraneous information found at the end of the statement. mnemonic
29
GENERATE Test program's function:
Illegal A-operand. Required A-operand Checked for correct
Illegal
not
tested:
LEAVE Test program's function:
Permutations
QUEUE Test
not
program's
Permutations
tested:
function:
not
tested:
A-operand,
SNA,
context.
B-operand,
SNA,
context.
B-operand.
Checked for Checked for Permutations
missing.
correct
undefined
operand.
Extraneous information found at the Presence of control characters. No label allowed.
end of the statement.
Illegal A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Checked for correct B-operand, SNA, Checked for multiply defined label. Extraneous information found at the end Presence of control characters. Invalid label. Illegal B-operand.
Illegal A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Checked for correct B-operand, SNA, Checked for multiply defined label. Extraneous information found at the end P.esence of controL characters. Invalid label. Illegal B-operand.
context. context.
of
the
statement.
context.
context.
of
the
statement.
RELEASE
Test
program's
Permutations
SEIZE Test
function:
not tested:
program's
function:
Invalid label. Illegal A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Extraneous information found at the end Presence of control characters. Checked for multiply defined label.
context.
label. A-operand. Required A-operand missing. Checked for correct A-operand, SNA, Extraneous information found at the end Presence of control characters. Checked for multiply defined label.
context.
of
the
statement.
Invalid Illegal
Permutations
not tested:
of
the statement.
TERMINATE
Test
program's
function:
Permutations not tested:
Label but no keyword. Illegal A-operand. Checked for correct A-operand,
SNA,
Extraneous information found at the Presence of control characters. Invalid
label.
Checked for multiply defined
30
context.
end of
label.
the statement.
TEST Test program's function:
Permutations
not
Illegal A-operand mnemonic specification. Illegal C-operand. Required B-operand missing. Checked for correct B-operand, SNA, context. Illegal C-operand. Checked for correct C-operand, SNA, context. Extraneous information found at the end of the statement.
tested:
Presence of control characters. Invalid label. Checked for multiply defined label. Checked for correct D-operand label
specification.
TRANSFER
Test
program's
Permutations
function:
Required B-operand missing. Extraneous information found at the end Presence of control characters. Invalid label. Checked for multiply defined label.
not tested:
of
the statement.
A representative GPSS program was written to test the interaction between the statements. Refer to Appendix C, page 207, for the test program. Below is a summarization of this test program. nineteen
TRAFFIC.GPS Test programs function: Permutations not tested:
Test interaction of nineteen GPSS statements. Presence of control characters. Test all options of each of the nineteen statements for
interrelationship
errors.
The symbol table was printed out after each test program to verify the contents. Refer to 7.3.7. Parser and Symbol Table test results, page 39 through 81, for the symbol table displays.
7.1.2. Pseudo
Code
Generation.
the parser module, due to the addition of the pseudo code skeleton the GPSS subset be tested for parser consistency. The same test programs as the parser phase (Appendix B, page 189, and Appendix C, page 207) were used for two purposes: 1. Verify the parser , 2. Test the production of pseudo code, and output
The
generation,
redesign of
required
Refer to 7.3.2. the program temporary variables which were added to the symbol table. Pseudo Code Generation test results, page 82 through 158, for the pseudo code generated displays.
7.1.3. Simulator
The
functionality Test
Case Test
and
Statistical
simulator required
of
the
Output.
testing to verify the
statistical report and
to verify the internal
chains.
1 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with only A-operand. Test TERMINATE statement. Test termination count of 1.
31
Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case Test
2 program's
function:
Test Test Test Test Test Test
evaluation
of
GENERATE TERMINATE termination random
FUNCTION
only A-operand.
statement.
count
number
transaction
statement.
with
statement
of
20.
generator.
transfer from Future to Current Events
chain.
Test
Case Test
3 program's
function:
Test Test Test Test Test Test
evaluation
of
GENERATE TERMINATE termination random
FUNCTION
only A-operand.
statement.
count
number
transaction
statement.
with
statement
of
100.
generator.
transfer from
Future to Current Events
chain.
Test
Case Test
4 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and a numeric B-operand. Test TERMINATE statement. Test termination count of 1. Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case Test
5 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and a numeric B-operand. Test TERMINATE statement. Test termination count of 20. Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case Test
6 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and a numeric B-operand. Test TERMINATE statement. Test termination count of 100. Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case Test
7 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand a function B-operand. Test TERMINATE statement. Test termination count of 1. Test random number generator.
32
and
Test transaction transfer from Future to Current Events chain.
Test
Case 8 Test program's function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and a function B-operand. Test TERMINATE statement. Test termination count of 20. Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case 9 Test program's function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and a function B-operand. Test TERMINATE statement. Test termination count of 100. Test random number generator. Test transaction transfer from Future to Current Events chain.
Test
Case Test
10 program's
function:
Test evaluation of FUNCTION statement. Test GENERATE statement with a function A-operand and no B-operand. Test TERMINATE statement. Test termination count of 100. Test random number generator. Test a model with "two GENERATE statements. Test transaction transfer from Future to Current Events chain.
Test
Case Test
1 1 program's
function:
Test evaluation Test GENERATE
of
VARIABLE
statement.
statement with a variable
A-operand
and
B-operand. Test TERMINATE statement. Test termination count of 1. no
Test transaction transfer from Future to Current Events chain.
Test
Case Test
1 2 program's
function:
Test evaluation of VARIABLE statement. Test GENERATE statement with a variable A-operand and no B-operand. Test TERMINATE statement. Test termination count of 20. Test transaction transfer from Future to Current Events chain.
Test
Case Test
13 program's
function:
Test evaluation Test GENERATE
of
VARIABLE
B-operand. Test TERMINATE statement. Test termination count of 100. no
33
statement.
statement with a variable
A-operand
and
transfer from
transaction
Test
Future to Current Events
chain.
Test
Case
Test
14 program's
function:
Test GENERATE no
statement with a numeric
A-operand
and
B-operand.
Test Test Test Test Test Test
TERMINATE termination a an
model
statement.
count
with
ADVANCE
the ASSIGN transaction
100. GENERATE
of
two
statements.
statement with a parameter
A-operand.
statement with an addition of a numeric.
transfer from
Future to Current Events
chain.
Test transaction transfer from Current to Future Events chain.
Test
Case 1 5 Test program's function:
Test GENERATE statement with a numeric A-operand and no B-operand. Test TERMINATE statement. Test termination count of 100. Test an ADVANCE statement with a parameter A-operand. Test two ASSIGN statements where one adds a numeric and
the
other
subtracts
a
numeric.
Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test
Case 16 Test program's function:
Test GENERATE statement with a variable A-operand and no B-operand. Test TERMINATE statement. Test termination count of 100. Test an ADVANCE statement with a variable A-operand. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test
Case Test
1 7 program's
function:
Test GENERATE statement with a numeric A-operand and no B-operand. Test TERMINATE statement. Test termination count of 100. Test a model with two GENERATE statements. Test an ASSIGN statement with an addition of a numeric. Test an ADVANCE statement with a parameter A-operand. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test
Case Test
18 program's
function:
Test GENERATE statement with a constant A-operand no B-operand. Test TERMINATE statement. Test termination count of 100.
34
and
Test an ADVANCE statement with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test an ENTER statement with a variable B-operand. Test a LEAVE statement with a numeric B-operand. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 19
Test
program's
function:
Test GENERATE statement with a constant A-operand and no B-operand. Test TERMINATE statement. Test termination count of 100. Test an ADVANCE statement with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a QUEUE statement with a variable B-operand. Test a DEPART statement with a numeric B-operand. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 20
Test
program's
function:
Test GENERATE statement with a constant A-operand and no B-operand. Test TERMINATE statement. Test termination count of 20. Test an ADVANCE statement with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a SEIZE statement. Test a RELEASE statement. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 21 Test program's function:
Test GENERATE with a constant A-operand and no B-operand. Test TERMINATE statement. Test termination count of 20 and a snap interval of 10. Test an ASSIGN statement with an addition of a numeric. Test a TEST statement where the A-operand is a parameter, the B-operand a numeric, and the C-operand, a label, is specified. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test
Case Test
22 program's
function:
Test GENERATE with a constant A-operand and B-operand. Test a model with two GENERATE statements. Test TERMINATE statement. Test termination count of 20.
no
Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric.
35
SEIZE statement. RELEASE statement. a GATE U statement where the A-operand is a facility, and the B-operand, a label, is specified. Test transaction transfer from Future to Current Events
Test Test Test
a a
chain.
Test transaction transfer from Current to Future Events chain.
Test
Case
Test
23 program's
function:
Test GENERATE
with
a
constant
A-operand
and
no
B-operand. Test TERMINATE statement. Test termination count of 20. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a SEIZE statement. Test a RELEASE statement. Test a GATE NU statement where the A-operand is a facility, and the B-operand, a label, is specified. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 24 Test program's function:
Test GENERATE with a constant A-operand and no B-operand. Test TERMINATE statement. Tjst termination count of 20. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a ENTER statement. Test a LEAVE statement. Test a GATE SE statement where the A-operand is a
location, and the B-operand, a label, is specified. Test transaction transfer from Future to Current Events storage chain.
Test transaction transfer from Current to Future Events chain.
Test Case 25 Test program's function:
Test GENERATE with a constant A-operand and no B-operand. Test TERMINATE statement. Test termination count of 20. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric Test a ENTER statement. Test a LEAVE statement. Test a GATE SF statement where the A-operand is a storage location, and the B-operand, a label, is specified Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 26 Test program's function:
Test GENERATE
36
with
a
constant
A-operand
and
no
B-operand. Test TERMINATE statement. Test termination count of 20. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a ENTER statement. Test a LEAVE statement. Test a GATE SNF statement where the A-operand is a storage location, and the B-operand, a label, is specified. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Test Case 27 Test program's function:
Test GENERATE with a constant A-operand and no B-operand. Test TERMINATE statement. Test termination count of 20. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a ENTER statement. Test a LEAVE statement. Test a GATE SNE statement where the A-operand is a storage location, and the B-operand, a label, is specified. Test transaction transfer from Future to Current Events chain.
Test transaction transfer from Current to Future Events chain.
Final Test Case
Test
program's
function:
Test GENERATE with a constant A-operand and a function B-operand. Test a model with three GENERATE statements. Test TERMINATE statement. Test two ADVANCE statements with a numeric A-operand. Test an ASSIGN statement with an addition of a numeric. Test a ENTER statement. Test a LEAVE statement. Test a QUEUE statement. Test a DEPART statement. Test a SEIZE statement. Test a RELEASE statement. Test a TRANSFER statement. Test a TEST G statement where the A-operand is a parameter, the B-operand is a constant, and the Coperand, a label, is specified. GATE U statement where the A-operand is a the B-operand, a label, is specified. Test a GATE SE statement where the A-operand is a and the storage is location, B-operand, a label, specified. Test transaction transfer from Future to Current
Test
a
facility,
and
Events chain. Test transaction transfer from Current to Future Events chain.
All
test
cases
were
executed
on
the
37
Rochester
Institute
of
Technology GPSS
The
running on a VAX/VMS 11/780. for the thesis output.
compiler
results were used as a validation procedure
Test Procedures.
7.2.
7.2.1. Parser and Symbol Table.
Each test program, listed in Appendix B and Appendix C, was run against the first the GPSS compiler/simulator. A command file was used to expedite the gathering the verification output. By assigning SYS$OUTPUT to a file called phasel.tst, as shown in
pass of of
the
generic
$ $ The
example
below, the
assign/user gpss
actual
phasel.tst
were
generated:
sys$output
filename.gps
output
7.2.2. Pseudo
results
has been
Code
included
in the test
results.
Generator.
Each test program, listed in Appendix B and Appendix C, was run against the second the GPSS compiler/simulator. A command file was used to expedite the gathering of the verification output. By assigning SYSSOUTPUT to a file called phase2.tst, as shown in the generic example below, the results were generated: pass of
$ $ The
assign/user gpss
actual
output
7.2.3. Simulator
The
phase2.tst
sys$output
filename.gps
has been
and
included
Statistical
in the test
results.
Output.
in section 7.3.3. Simulator and Statistical Output was for each test case. R.l.T.'s statistical output and the thesis statistical output was placed on the same page allowing easy comparisons of the simulations results. Also, any discrepancies in output are explained above the statistical obtained
statistical output contained
by executing
the
simulator
output.
can be seen in the test case results, a comparison of the absolute clock times for the programs differ. The difference in the philosophy of the two simulators is the many thesis absolute clock time is allowed to circulate through the current events chain on the end termination count. R.l.T.'s, on the other hand, gets to the end termination count and
As
of
immediately exits the program. Also, the R.I.T. simulator, for many of the programs, has a transaction in the GENERATE current block statistics. The GENERATE statement in this thesis
works
per
XEROX
GPDS
standards
which
read:
After the BDT has been calculated, the transaction is stored on the future events chain. When its scheduled entry time (BDT) arrives, the transaction is then moved to
The transaction is events
the
current
events
not calculated
chain.11
into the
current
chain.
38
block statistics
until
it enters the current
Test Results.
7.3.
7.3.1. Parser and Symbol Table.
Control Statements: SIMULATE
The parser correctly tested for no operands allowed for a SIMULATE statement, two SIMULATE statements encountered, no label allowed, and extraneous information found at the
the
of
end
statement.
START
The operand
correctly tested for no label allowed, illegal A-operand, required Aillegal B-operand mnemonic specification, illegal C-operand, and information found at the end of the statement. parser
missing,
extraneous
END
The statements
the
parser correctly tested for no operands allowed for an END statement, two END encountered, no label allowed, arid extraneous information found at the end of
statement.
Entity Definition Statements: FUNCTION
The parser correctly tested for invalid label, incorrect specification of the random function specification, correct function number, incorrect discrete label, incorrect FUNCTION keyword, X data not floating point, Y data not integer, and extraneous information found at the end of the statement. STORAGE The parser correctly tested for no label specified for the STORAGE statement, invalid label, duplicate STORAGE label, illegal A-operand, required A-operand missing, and extraneous information found at the end of the statement. VARIABLE correctly tested for no label specified for the VARIABLE statement, line defined variable in the variable statement, checked for correct variables SNA (Standard Numerical Attributes), number (0 through within the arithmetic statements: 9), if the variable in the expression was an SNA, the SNA was checked to make sure it was [-]operand operator [previously defined, checked for correct arithmetic expressions: exp-.: ]operand / exp operator; where the operand is a valid variable and the operator is + -, *, or /, checked for undefined SNA, and extraneous information found at the end of the
The
cannot
parser
use
=
,
statement.
Block Definition Statements:
ADVANCE The checked for of
the
parser
correct
correctly tested for
A-operand, SNA,
an
illegal
A-operand,
required
A-operand missing, found at the end
context, and extraneous information
statement.
ASSIGN
The
parser
correctly tested for
an
illegal A-operand, required A-operand missing,
39
for
checked
A-operand, SNA, context, illegal B-operand, invalid B-operand arithmetic B-operand, SNA, context, checked for undefined SNA, and
correct
operation, checked for correct extraneous
information
found
at
the
end
of
the
statement.
DEPART an illegal A-operand, required A-operand missing, BA-operand, SNA, context, illegal B-operand, checked for correct information found at the extraneous for and undefined SNA, SNA, context, checked
The operand, end
parser
for
checked
the
of
correctly tested for
correct
statement.
ENTER
The parser correctly tested for an illegal A-operand, required A-operand missing, Bchecked for correct A-operand, SNA, context, illegal B-operand, checked for correct for multiple and checked for undefined checked labels, SNA, operand, SNA, context, extraneous information found at the end of the statement. GATE parser correctly tested for an illegal for correct B-operand, SNA, context in illegal C-operand.
The
checked and
mnemonic
A-operand, illegal B-operand,
comparison
to the A-operand mnemonic,
GENERATE The parser correctly tested for an illegal A-operand, required A-operand missing, checked for correct A-operand, SNA, context, illegal B-operand, checked for correct Boperand, SNA, context, checked for undefined operand, and extraneous information found at the end
the
of
statement.
LEAVE
The parser correctly tested for an illegal A-operand, required A-operand missing, for correct A-operand, SKA, context, checked for correct B-operand, SNA, context, checked for multiply defined label, and extraneous information found at the end of the checked
statement.
QUEUE
The parser correctly tested for an illegal A-operand, required A-operand missing, for correct A-operand, SNA, context, checked for correct B-operand, SNA, context, checked for multiply defined label, and extraneous information found at the end of the checked
statement.
RELEASE
The parser correctly tested for an invalid label, illegal A-operand, required A-operand missing, checked for correct A-operand, SNA, context, and extraneous information found at the end of the statement. SEIZE
The
parser
correctly tested for
missing, checked for correct
the
the
of
end
an
invalid label, illegal
A-operand, SNA, context,
A-operand,
and extraneous
required A-operand information found at
statement.
TERMINATE
The correct
parser
correctly tested for
A-operand, SNA,
context,
a
label but no
and
extraneous
keyword, illegal A-operand, information found
at
the
checked end
of
for the
statement.
TEST
The operand,
C-operand, at
the
correctly tested for an illegal A-operand mnemonic specification, illegal CB-operand missing, checked for correct B-operand, SNA, context, illegal checked for correct C-operand, SNA, context, and extraneous parser
required
end
of
the
information found
statement.
40
TRANSFER
The information
parser
found
correctly tested for a required at the end of the statement.
B-operand
missing,
and
extraneous
TRAFFIC.GPS
The
parser
correctly tested the
nineteen
* * *
NOTE the following pages are the parser and capabilities of the hardware, an underscore is an the representation for the underscore.
41
GPSS symbol
statements.
table test
undefined
results.
character.
The
Due to printing character is
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
1
parsing test for ADVANCE
2 3 4
statement
simulate
5 6 7 8 9 10
1
1
storage
varl
variable
1
function fund 0.1,1/0.2,2
r,d2
i
label
!
advance
required
operand
missing
*
>>
Required
11
operands
advance
>>
is
Operand
12 >>
13 14 15
is
Operand
[illegal
operand
Mllegal
operand
valid
not
advance
missing
PI
pi
valid
not
4
advance
p*l
advance
P*l
!ok, !ok,
parameter
5 6
advance
s*l
!not
allowed
SNA
!not
allowed
SNA
variable
>>
Operand
16
is
not
valid
S*l
advance
parameter
*
>>
18 19
is
Operand
8 9 10
17
valid
not
advance
v'varl
advance
V*varl
!ok, !ok,
advance
f*l
Mnvalid
variable specification
of
*
>>
Operand
is
not
valid
20 21 22 23
11 12 13
advance
advance
fn*funcl FN'funcl 1
14
advance
a
24
15
advance
>>
is
Operand
not
advance
!ok, !ok,
function function
!ok Mllegal
operand
valid
[required
,
operand
*
Required
>>
16
25
operands
1
advance
missing
,
Isyntax
error
!ok Isyntax
error
*
Syntax
>> 17
26 27
error
advance
400
advance
Syntax
>> #
%$28
Syntax
>> 18
29
error
advance
Syntax
>>
1
1
Isyntax
error
end
A************************************************
Symbol
Table Contents
Label
1
:
Label Length
Label
:
after
First
Pass
Completion
STORAGE information: 1
attribute: of
varl
Label Length
VARIABLE information: 2
attribute: of
Information
stored:
1: Label
:
fund Label
attribute:
label
error
advance
30
!illegal
FUNCTION
42
error
missing
function
Number
of
points
in
Label
:
function:
the
0.100000 0.200000 Length of information:
2
1 2 2
label Label
LABEL
attribute:
*************************************************
Total number of errors Simulation phase will *
GPSS exiting
12 not
occur
due
to
ERRORS
*
43
GPSS VI. 0 author:
May, 1984
-
Van Dellon
J.
1 2
parsing test for ASSIGN
statement
3 4
simulate
5
1
storage
6 7 8 9 10
varl
variable
1 1
fund
function
r,d2
0.1,1/0.2,2 ass
gn
1,-1
11
ass
9"
p*l,+2
12
ass
gn
fn*funcl,-l
13 14
ass
9n
v*varl,+2
ass
9"
l.+p*l
15
ass
gn
16
ass
gn
1 1
17
ass
gn
>>
Requ
18
20
11
lok
,+fn*fgncl
,
lok
-v*varl
(required
operands
red
is
not
[invalid
>> Operand
is
not
specification
valid
Icomma
not
in
proper
*
>>
Required
12
21
operands
missing Ino
1,
assign
specified
numeric
*
>>
Syntax
13
22
error
a,-l
assign
Mllegal
A-operand
[illegal
B-operand
Mllegal
SNA
lillegal
SNA
*
>>
Operand
14
23
is
not
valid
1,+b
assign
*
>>
24
Operand
15
is
not
valid
s*l,+l
assign
m
>> 25
Operand
16
is
not
valid
l,-s*l
assign
*
>>
Operand
17
26
is
not
assign
valid
v*var2,+l
[undefined
operand
[undefined
operand
*
>>
Undefined
operand *
>> Operand 27
18
is
not
valid
l,+vvar2
assign
*
>>
Undefined
operand *
>> Operand
28
not
valid
end
Symbol
Table
Label
1
:
Contents
Label Length
Label
is
:
after
attribute:
of
First
Pass
Completion
STORAGE 1
information:
varl
Label Length
attribute:
of
VARIABLE 2
information:
Information
stored:
1: Label
:
fund Label
attribute:
of
I inval id A-operand
l+,2
assign
missing
valid
+1,2
assign
operand
missing
1.+-3
>> Operand 10
lok lok
,-Z
assign
19
lok !ok lok
FUNCTION
44
place
arithmetic
points in the function: 0.100000 1 0.200000 2 Length of information: 2
Number
Total
number
Simulation *
of
of
phase
errors
=
will
not
13 occur
due
to
ERRORS
GPSS exiting
45
May. 1984 GPSS VI. 0 J. Van Dellon
author:
1
2
for DEPART
test
parsing
statement
3 simulate
5 e 7 8 9
a
variable
1
b
variable
storl
storage
1 20
function fund 0.1,1/0.2,2
r,d2
10
11
depart
[not
s*storl
a
good
queue
definition
*
>> Operand
label
12
>>
is
Required
[required
operands
depart depart
13 14 >>
Operand
is
lok !A-operand
not
>>
Required
[missing
val
id
operands
B-operand
id
val
[required
depart
not
valid
depart
17
missing
mssing
a
is not depart a,
16
operand
1
Operand
15 >>
val id
not
depart
operand
missing
missing [illegal
a.b
specification
of
SNA's
*
>> Operand
is not valid v*a.v*b depart depart pi
18 19
>> Operand label
20
>>
is
not
departr
Multiply
!ok,
variable
[illegal
specifications
operand
val id
1
[multiple
defined
labels
label
21
1C
depart
l,vb
22 23
11
depart
v*a,2
:ok
12
depart
s*l
[not
defined SNA
'ok.
correct
24
>>
Undefined
>>
Operand is not val depart p*l.l
13
25
:ok
operand
id
end
gig*****.********'******************.***'****''*****
Symbol
.abel
:
Table Contents
after
First
Pass
Completion
a
Label Length
attribute:
of
VARIABLE
information:
Information
2
stored:
1: Label:
b Label Length
attribute:
of
VARIABLE
information:
Information
2
stored:
1: Label
:
storl
Label
Length Label
:
attribute: of
STORAGE
information:
20
fund Label Number
attribute: of
points
0.100000 0.200000
FUNCTION in
the function:
2
1 2
46
specification
Length Label:
Total
label Label
number
Simulation
of
information:
LABEL
attribute:
of
phase
10
errors
s
will
not
GPSS exiting
2
occur
due to ERRORS
*
47
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
parsing test for END statement FIRST of THREE test routines simulate
Ino
a
end
operands
allowed
*
>>
is
Operand
not
valid
Imisspelling
endd
take
as
label
to
comma
*
>>
Label
but
valid
no
statement
[duplicate
end
end
*
END
>>
Multiple label end
statements
Ino
label
allowed
*
>>
Label
not
allowed
h*****s************************s***s******4
Symbol
Table Contents
Label:
label Label
Total
number
Simulation *
of
Pass Completion
LABEL
attribute:
4
errors
=
will
not
phase
First
after
occur
due
to
ERRORS
GPSS exiting
GPSS VI. 0 May, 1984 J. Van Dellon
author-
parsing test for END SECOND of THREE test
statement routines
simulate end
>>
Operand
#S*
7
>>
8
Syntax
GPSS VI. 0 J. Van
error
valid
Mllegal
label
error
Syntax
[syntax
error
error
3 not
occur
due
to
ERRORS
*
GPSS exiting
author:
not
end
Total number of errors Simulation phase will
*
is
end
,
>>
Isyntax
,b
May, 1984 Dellon
parsing test for END statement THIRD of THREE test routines simulate end
lok
48
due
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
i
1 2
I !
parsing test for ENTER
4
statement
simulate
5 6
a
variable
l
b
variable
7 8 9 10 11 12
storl
storage
l 20
1 2
13 14
3 4
fund function 0.1,1/0.2,2
r,d2
! enter
label >>
s'storl
storage label specification [required operand missing
|0k,
enter
Required
operands
missing
enter
1
lok
enter
a
!A-operand
not
valid
*
>> Operand 16
5
1
6
17
7
is
not
enter
Operand is
>>
val
id
a, not
enter
IB-operand missing valid
Irequired operand missing
,
>> Required operands missing enter
a,b
[illegal
specification
of
SNA's
>> Operand
18 19
8 9
is not valid enter Va.v'b
lok,
enter
[illegal
>> Operand
20
label >>
21 22 23
is
pl
not
Multiply
10 11 12
val
specifications
operand
id
1
enterr
variable
[multiple labels
defined label l,v*b
enter
!ok
enter
v*a,2
!ok
enter
sl
[not
defined SNA
!ok,
correct
>> Undefined operand >> Operand
24 26
13
is not
enter
valid
p*l,l
end
Symbol
Table Contents
Label
a
:
Label
Length
attribute: of
First
Pass Completion
VARIABLE
information:
Information 1:
Label:
after
2
stored:
b Label
attribute:
VARIABLE 2
Length of information: Information stored: 1:
Label:
storl
Label attribute: STORAGE Length of information; 20
Label: fund Label Number
attribute: of
points
FUNCTION in the function:
Length
0.200000 information:
of
2
1 2
0.100000
2
49
specification
Label
:
label Label
Total
number
Simulation *
LABEL
attribute:
of
phase
9
errors will
GPSS exiting
not
occur
due
to
ERRORS
*
50
GPSS VI. 0 0. Van
May, 1984
-
Dellon
author:
parsing test for function
statement
simulate
fund >> .5,
function
Operand is 5/. 8, 8
not
Mncorrect
rl,d2
specification
of
random
number
valid
lerror
on
llabel
error
lerror
on
line due
to
faulty
function definitio
line due to
faulty
function
>>
Syntax error lfunc function >>
Illegal 8, 8
rl,d2
specification
of
label
.5.5/.
>> Syntax error func2 functi >>
10 n
.5,
Syntax 5/. 8, 8
12
function
specification
error
lerror
>> Syntax error func3 function
11
Mllegal
r,d2
definitio
on
Mllegal
r,d
>>
Illegal
specification
of
numeric
>>
Illegal 8, 8
specification
of
operand
specification
on
*
Syntax error func4 function
to
faulty
of
function definitio
discrete function
quantity
lerror
.5.5/.
line due
line due to
faulty
function definiton
>>
13
14
>>
Illegal
specification
of
numeric
>>
Illegal 5/. 8, 8
specification
of
operand
.5,
r,d2
lok lok
r,d2
Ityping
>> Syntax error function func9 2, 3/. 4, 7 function funclO
r,d3
lok
r,d3
lok lok
.1,1/.
lok
.1,1/0.4.4/0.85,7
Table Contents
Label
fund
:
Label :
First
attribute:
FUNCTION
attribute:
LABEL
Pass
Completion
lfunc Label
:
after
line due
f unc2
51
to
specification
lok lok lok
r,d2
.5.
Symbol
on
Mllegal
>> Syntax error func7 function 0.5. 5/. 6, 6 function func8 5/. 6. 7
23 24 25 26
Label
lok
1.2/3,4
19 20 21 22
Label
r,d2
.5.
specification
of
discrete
function
quantity
[error
>> Syntax error func5 function 5/. 8, 8 func6 function
15 16 17 18
Mllegal
r,d*2
error
faulty
due
to
function definitio
random
number
Label
Label
:
Label
attribute:
LABEL
f unc3 Label
attribute:
FUNCTION
attribute:
FUNCTION
attribute:
FUNCTION
func4
:
Label
Label
func5
:
Label
in the function: 0.500000 5 8 0.800000 Length of information: 2
Number
Label
func6 Label
:
of
points
FUNCTION
attribute:
in the function: 0 0.000000 0.000000 0 Length of information: 2
Number
Label
:
func7 Label
of
points
FUNCTION in the function:
attribute:
Number
of
points
0.500000 0.600000 Length of information: Label
:
Label
2
FUNCTION
attribute:
Length
of
in
points
of
function: 5 0
the
information:
f unc9 Label attribute: Number of points
Length'
Label:
2
5 6
0.500000 0.600000
:
2
f unc8 Number
Label
2
2
FUNCTION
in the function: 0.100000 1 0.200000 3 0.400000 7 of information: 3
funclO Label attribute: Number of points
FUNCTION in the function:
0.100000 0.400000 0.850000 Length
of
2
3
3
1 4
7
information:
3
*************************************************
>>
No
Total
END
number
Simulation *
statement
of
phase
encountered
errors will
GPSS exiting
15
-
not
occur
due to ERRORS
*
52
GPSS VI. 0 May, 1984 J. Van Dellon I ! parsing test I -
author:
1
2 3 4
statement
simulate
5 6 7 8 9 10
1
11
2
12 13 14
1
storage
varl
variable
1 1
fund function 0.1,1/0.2.2
r,d2
i
labell
gate
>> Operand
15
for GATE
u
is
not
gate
u
3
label2 labe!3
gate
u
4
label4
gate
u
5 6
label5
gate
u
gate
nu
s*l.label2
! invalid SNA
f n*f unci Iabel3 Vvarl p*l, labell 1, labell
lok
valid .
lok
,label4
s*l,label2
lok lok I inval id
lok
SNA
*
>> 16 17 18 19
20 21
Operand
is
not
valid
7 8 9
gate
nu
fn*f unci
gate
nu
v*varl
gate
nu
p*l,label2
lok
10
gate
nu
1, labell
lok
11 12
gate
sf
s*l, labell
gate
sf
p*l, labell
lok I il legal
SNA
Mllegal
SNA
Mllegal
SNA
label 2 label2
,
,
lok
m
>>
Operand
is
not
valid
labell
22
13
23
14
24
15
gate
se
s"l, labell
lok
25
16
gate
se
p*l, labell
Mllegal
SNA
26
17
fn*funcl
Mllegal
SNA
27
18
Mllegal
SNA
28
19
1,1
Mllegal
SNA
s*l,l
Mllegal
label
gate
>>
Operand
sf
is
gate
>> Operand
>>
Operand
is
is
gate
>>
Operand
is
gate
>>
Operand
is
gate
not
v*varl
valid
fnf unci
sf
not
not
valid
labell
,
valid v*varl
se
not
label 1
,
valid
se
not
,
label 1
,
valid
sf *
>>
29
20
Operand
is
gate
not
valid
sf *
>>
Illegal
of
specification
label
30 31
21
gate
snf
s*l, labell
lok
22
gate
snf
p*l, labell
! illegal
SNA
32
23
Mllegal
SNA
33
24
Mllegal
SNA
34 35
25
gate
sne
26
gate
sne
lok ! i 1 legal
SNA
Mllegal
SNA
Mllegal
SNA
1,1
Mllegal
SNA
s*l,l
Mllegal
label
>>
Operand
is
gate
>>
Operand
is
gate
>>
Operand
is
not
valid v"varl
snf
not
label 1
valid
fn*f unci
snf
not
,
,
label 1
valid
s*l. labell p*l, labell
,
*
>>
36
27
37
28
Operand
is
gate
>> Operand
is
gate
not
valid
fn*f unci
sne
not
,
label 1
valid
Vvarl
sne
.
label 1
*
>>
38
29
39
30
Operand
is
gate
>> Operand
is
gate
not
valid
snf
not snf
valid
53
Illegal
>>
31
40
of
specification
gate
label
1, labell
ru *
Illegal
>>
41
Symbol
Table Contents
Label:
1 Label
:
after
specified
First
Pass Completion
STORAGE 1
attribute:
Length
Label
option
end
information:
of
varl
Label
VARIABLE
attribute:
information: Information stored: Length
of
2
1: Label
:
fund Label
attribute:
Number
of
points
FUNCTION in the function:
0.100000 0.200000 Length of information: Label:
Label:
Label:
Label:
attribute:
LABEL
Label
attribute:
LABEL
label3 Label
attribute:
LABEL
label4 Label
attribute:
LABEL
attribute:
LABEL
label2
labels Label
Total
number
Simulation *
2
labell Label
Label:
2
1 2
of
phase
errors will
GPSS exiting
19
;
not
occur
due
to
ERRORS
*
54
Mllegal
mneumonic
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
1 2
parsing test for GENERATE
statement
3 4
simulate
5 6 7 8 9
1
storage
varl
variable
1 1
fund function 0.1,1/0.2,2
r,d2
i
10
1
generate
11
generate
12
2 3
13
4
generate
14
5 6
generate
generate
>>
16
1 6.1 l.p"l
Operand
is
not
lok
lok Ican't
no
parameters
are
evaluated
yet
cause
no
parameters
are
evaluated
yet
valid
l.fn^funcl l,v"varl p*l l
generate
cause
lok lok
Ican't
,
1 >>
Operand
is
not
valid
6
7
generate
v*varl,l
lok
17
generate
fnfuncl,l
lok
18
8 9
generate
s'l.l
Mllegal
SNA
19
10
[illegal
SNA
>>
Operand
is
not
valid
l.s'l
generate
*
>>
20
11
21
12
Operand
is
not
generate
>>
valid
[required
,1
operand
missing
Required operands missing Isyntax
1,
generate
error
*
>>
22
13
Syntax
error
fn*func2
generate
(undefined
function
*
>>
Undefined
>>
Operand
14
23
operand
is
not
valid
1
1
generate
Isyntax
error
Isyntax
error
*
>> 24
16
Syntax
>>
21
Syntax
1.1.1
error
end
Symbol
Table Contents
Label:
1 Label Length
Label
error
generate
:
after
attribute:
of
First
Pass Completion
STORAGE 1
information:
varl
Label
attribute:
VARIABLE
Length of information: Information stored:
2
1: Label
:
fund Label Number
attribute:
of
points
FUNCTION in the function:
Z
0.200000 Length
of
information:
Total number of errors Simulation phase will GPSS exiting
-
not
2
1
0.100000
2
10 occur
due
to
ERRORS
55
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
1 2 3
!
1
test
parsing
LEA'
for
i
4
simulate
5 6 7 8 9 10 11 12
a
variable
1
b
variable
storl
storage
1 20
function fund 0.1,1/0.2,2
r,d2
!
1 2
leave leave
label
lok,
s*storl
storage
Irequired
label
operand
specification
missing
*
>>
13 14
3
15
5
4 >>
Required operands missing 1 leave leave a Operand is leave
not
lok
Mllegal
A-operand
valid
Ino
a.
B-operand
*
>> Operand 16
is leave
6
not
valid
[required
,
operand
missing
*
Required operands missing a.b leave
>> 17
7
18 19
8 9
>> Operand
is leave leave
!ok,
Pi
[illegal
>>
[multiple
defined label leave l,vb leave v*a,2 leave s'l
11 12 >>
Undefined
is leave
26
not
Table Contents
Label
a
Label Length
lok
after
First
Pass
Completion
VARIABLE information: 2
Information
stored:
1: Label
:
b Label Length
attribute: of
VARIABLE
information:
Information
2
stored:
1: Label
:
storl
Label Length
Label:
attribute:
of
STORAGE 20
information:
fund Label Number
attribute: of
points
FUNCTION in the function:
0.200000 of
information:
2
1 2
0.100000 Length
Inot
defined SNA
'ok,
correct
valid
p'1.1
attribute: of
labels
!ok
end
Symbol
SNA's
specifications
operand
operand
>> Operand
13
:
variable
Multiply
10
24
of
valid
label
21 22 23
specification
valid
v*a, v*b
Operand is not leaver 1
>>
20
not
[illegal
2
56
specification
Label
:
label Label
attribute:
LABEL
Total number of errors = 9 Simulation phase will not occur
due
to
ERRORS
GPSS exiting
57
GPSS VI. 0 May, 1984 J. Van Dellon -
author
1 2
for QUEUE
test
parsing
statement
3 4
simul ate
5 6 7 8 9 10 11
a
variable
1
b
variable
storl
storage
1 20
function fund 0.1.1/0.2,2
r,d2
i
>> Operand
12
label
!ok,
s'storl
queue
is
not
storage
label
specification
valid
'required
queue
operand
missing
*
>>
Required
13 14
operands
missing
queue
1
!ok
queue
a
! illegal
A-operand
*
>> Operand
15
is
not
queue
>> Operand
16
valid
Ino
a,
is
not
B-operand
valid
[required operand missing
queue *
>>
Required
17
operands
queue
missing Mllegal
a.b
specification
of
SNA's
*
>> Operand
18 19
is
not
valid
queue
v*a,v*b
lok,
queue
pi
! illegal
variable
specifications
operand
*
Operand is not label queuer 1
>>
20
>>
21 22
24
label
l,v*b
queue
v*a,2
lok !ok
queue
s'l
!not
defined
SNA
lok,
correct
specification
Undefined
>>
Operand
13
operand
is
not
valid
p*l,l
queue end
Symbol
Table Contents
Label
a
:
Label
after
attribute:
First
Pass
Completion
VARIABLE
information: Information stored:
Length
of
2
1: Label
:
b Label
attribute:
VARIABLE
Length of information: Information stored:
2
1:
Label:
storl
Label Length
Label
:
attribute: of
STORAGE
information:
20
fund Label Number
attribute:
of
points
0.100000 0.200000
labels
queue
>>
26
'multiple
Multiply defined
10 11 12
23
valid
FUNCTION in the function:
2
1 2
58
Length Label
:
number
attribute:
of
Simulation phase *
information:
2
label Label
Total
of
errors
*
will
not
LABEL
10 occur
due
to
ERRORS
GPSS exiting
59
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
1
parsing test for RELEASE
2 3 4
statement
simulate
1
5
1
storage
6 7 8 9
jacky
variable
10
label
function fund 0.1.1/0.2,2
>>
11
r,d2
[required
release
Required
la
operands
missing
missing label
[illegal
2
release
operand
*
>>
Illegal
specification
of
label
12
release
1
lok
13
release
a
[not
allowed
SNA
*
>> Operand 14
is
not
release
>>
Operand
15
is
valid
[illegal
pi
not
of
SNA
valid
[syntax
1,
release
specification
error
*
>>
Syntax
16
error
release
[required
,1
operand
missing
*
>>
Required
17
operands
release
>>
Operand
is
missing Mllegal
PI
not
specification
valid
18 19 20
9
release
p*l
release
P*l
!ok, lok,
parameter
10
11
release
s*l
Inot
allowable
SNA
21
12
Inot
allowable
SNA
22 23
13 14
release
v*jacky
lok,
variable
release
V*jacky
I ok,
variable
24
15
release
f*l
[facility
>>
Operand
is
not
release
>>
Operand
is
valid
S'l
not
parameter
valid
not
*
>>
is
Op srand
not
valid
release
26
16 17
release
FN'funcl fn'funcl
27 28 29
18 19 20
release
p*l
release
P*l 1
25
release
>>
Syntax
30
lok, lok, lok, lok,
function function parameter parameter
[syntax
error
Isyntax
error
error
release *
>> Syntax error @## release
31
>>
32
Syntax
error
end
Symbol
Table Contents
Label
1
:
Label Length Label
Mllegal
:
after
First
Pass
Completion
STORAGE information: 1
attribute: of
jacky VARIABLE information: 2 Information stored: Label
Length
attribute: of
60
label
allowed
of
SNA
1: Label
fund
:
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2
Label
attribute:
Number
Label
Label
Total
:
:
of
points
label Label
attribute:
LABEL
la Label
attribute:
LABEL
number
Simulation
of
phase
13
errors will
2
not
occur
due
to
ERRORS
GPSS exiting
61
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
1 2
parsing test for SEIZE
statement
3 4
simulate
5 6 7 8 9 10
1
storage
jacky
variable
1 1
function fund 0.1,1/0.2,2
r,d2
i
label >>
11
Required
la >>
[required
seize
operands
Illegal
of
specification
label
seize
1
lok
13
seize
a
Inot
is
not
>>
Operand
allowed
SNA
valid
Mllegal
pi
seize
label
Mllegal
12
14
missing
missing
2
seize
operand
specification
of
SNA
*
>>
Operand
15
is
not
>>
Syntax
16 >>
error
Required
Operand
[required
,1
operands
is
not
operand
missing
missing Mllegal
PI
seize
>>
Isyntax
error
seize
17
valid
1,
seize
specification
valid
seize
p"l
seize
?1
!ok, !ok,
parameter
19
9 10
20
11
seize
s*l
Inot
allowable
SNA
21
12
Inot
allowable
SNA
variable
18
>>
is
Operand
not
valid
S*l
seize
parameter
*
>>
is
Operand
not
valid
22 23 24
13 14
seize
v*jacky
seize
V'jacky
lok, lok,
15
seize
f*l
[facility
25 26 27
16 17
seize
FN*funcl
seize
fn*funcl
18 19 20
seize
p*l
seize
P*l 1
>>
28 29
Operand
is
not
seize
Syntax
>>
30
variable not
valid
lok, lok, lok, lok, 1
function function parameter parameter
Isyntax
error
Isyntax
error
error
seize *
>> Syntax error @## seize
31
Syntax
>>
32
error
end
Symbol
Table Contents
Label:
1 Label Length
Label
Mllegal
:
after
First
Pass
Completion
STORAGE information: 1
attribute: of
jacky Label Length
VARIABLE information: 2
attribute: of
Information
stored:
62
label
allowed
of
SNA
Label
:
fund FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2
Label
Number
Label
:
Label:
attribute: of
points
2
label Label
attribute:
LABEL
la Label
attribute:
LABEL
Total number of errors 13 Simulation phase will not occur due * GPSS exiting
to
ERRORS
63
GPSS VI. 0 May, 1984 J. Van Dellon -
author-
parsing test for SIMULATE statement FIRST of THREE test routines
>>
Operand
is
[no
a
simulate
not
Label
Imisspelling
but
valid
allowed
valid
simulatte
>>
operands
no
take
as
label
statement
Iduplicate
simulate
simulate
*
Multiple SIMULATION label simulate
>>
>>
Label
not
statements
Ino
label
allowed
allowed
end
Symbol
Table Contents
Label
label Label
:
after
Pass Completion
First
LABEL
attribute:
a************************************************
Total
number
Simulation *
of
4
errors
=
will
not
phase
GPSS VI. 0 author-
J.
occur
due
to
ERRORS
*
GPSS exiting
May, 1984 Van
Dellon
parsing test for SIMULATE statement SECOND of THREE test routines simulate
>>
Syntax
#$*
>>
Isyntax
,b
error
simulate
Syntax
Mllegal
8
Syntax
label
error
simulate
>>
error
Isyntax
error
end
Total number of errors 3 Simulation phase will not occur due * * GPSS exiting -
to
ERRORS
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
parsing test for SIMULATE THIRD
of
THREE test
statement
routines
simulate
lok
end
64
error
due
to
comma
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
parsing test for START
statement
simulate i
label
1
start
Mabel
not
allowed
*
>>
Label
not
allowed
start
>>
Syntax
Isyntax
error
error
start
1
lok
start
a
Mllegal
operand
*
>>
Undefined
10
operand
start
[required
,NP,3
operand
missing
*
>>
Required
operands
missing
11
start
l.np
lok
12 13
start
1,,
Isyntax
start
1
,
Mllegal
,c
correct, operand
*
>> 14
15 16
Undefined operand start 1..2 start l.NULL l.bb
start
>>
Operand
17
lok lok
is
not
start
1
! i 1 legal
valid
[syntax
np *
>>
Syntax
18
error
end
Symbol
Table Contents
Label
label Label
:
after
First
Pass
7 Total number of errors Simulation phase will not occur due GPSS exiting
Completion
LABEL
attribute:
option
to
ERRORS
*
65
error
just
no
arguements
*
GPSS VI. 0 May, 1984 J. Van Dellon -
*
author:
1
2 3
parsing
4
test
for STORAGE
statement
simulate
5
!
6
label
Imissing
storage *
>>
Label
required
7
a
storage
1
storage
2 3
lok
8 9
la
storage
4
lok
lok
*
>>
Illegal
specification
of
numeric
>>
Illegal
specification
of
label
1
10
storage
quantity
[duplicate
5
label
*
>>
Multiply
2
11
defined
label [required
storage
operand
m
>>
Required
3
12
operands
storage
missing [illegal
six
operand
*
>>
Operand
4
13
>>
Syntax
5
14
>>
>>
16
Syntax
Syntax
>>
>>
Isyntax
error
8,9
[syntax
error
Isyntax
error
[syntax
error
error
error
10
11
error
storage
Syntax
$%tt
18
valid
7,
storage
,
17
not
storage
6
15
is
storage
error
storage
Syntax
1
Mllegal
error
end
*********************************
Symbol
Table Contents
Label
a
:
Label
Length
Label
:
Length
Label
Label
Label
:
:
:
la Label
:
STORAGE information: 2
attribute:
of
STORAGE 3
information:
Label
attribute:
STORAGE
Label
attribute:
STORAGE
Label
attribute:
2
3
4
of
STORAGE information: 7
5 Length
:
of
STORAGE
Label
Label
Pass Completion
attribute:
attribute:
Length
Label
First
1 Label
Label:
after
attribute:
of
STORAGE 8
information:
6
66
label
missing
Label
Total
number
Simulation
STORAGE information: 10
attribute:
Length
of
of
phase
errors will
-
not
11 occur
due
to
ERRORS
GPSS exiting
67
GPSS VI. 0 May, 1984 J. Van Dellon
author:
1 I
2 3
t test
parsing
4
for TERMINATE
statement
simulate
1
5
1
storage
6 7 8 9 10 11 12 13
varl
variable
1
fund
function
r,d2
0.1,1/0.2,2 i
label
1
lok
terminate
default
2 3
terminate
!ok,
terminate
!ok
4
terminate
Isyntax
1
error
*
>>
Syntax
5
14
error
Mllegal
terminate
>>
Operand
15
is
not
valid
terminate
>>
Syntax
16
Isyntax
error
Isyntax
error
error
terminate
>>
operand
Syntax
error
lok
5
17
terminate
18
terminatte
[misspelling,
error
*
>>
Label
19
but
valid
no
statement
[syntax
terminate
error
*
>> Syntax error @## terminate
20
>>
Syntax
21 >>
Operand
10
label
PI
Mllegal
operand
pi
[illegal
operand
p*l
[no
SNA's
allowed
P*l
[no
SNA's
allowed
s'l
Ino
SNA's
allowed
S*l
Ino
SNA's
allowed
v*l
Ino SNA's
allowed
V*l
Ino
SNA's
allowed
fn*l
!no SNA's
allowed
FN'l
Ino SNA's
allowed
error
terminate
22
[illegal
is
valid
not
terminate *
>>
23
11
24
12
25
13
Operand
is
not
valid
terminate
>>
Operand
is
not
valid
terminate
>> Operand
is
not
valid
terminate *
>>
26
Operand
14
is
not
valid
terminate *
>>
27
15
28
16
29
17
Operand
is
not
valid
terminate
>>
Operand
is
not
valid
terminate
>> Operand
is
not
valid
terminate *
>>
30
Operand
>>
31
is
not
valid
terminate
18
Operand
is
not
valid
end
ft***********************************************
Symbol
Table Contents
Label
1
:
after
First
Pass Completion
68
Label
Label
STORAGE information: 1
attribute:
Length
of
varl
:
VARIABLE information: 2 Information stored:
Label
attribute:
Length
of
1: Label
:
fund FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2
Label
Number
Label
:
attribute: of
points
2
label Label
attribute:
LABEL
Total number of errors 17 Simulation phase will not occur due * GPSS exiting -
to
ERRORS
69
GPSS VI. 0 May, 1984 J. Van Dellon -
author:
2 3
parsing
4
for TEST
test
statement
simulate
5
1
storage
1
6 7
varl
variable
1
function fund 0.1.1/0.2,2
8 9 10
labell label2 labe!3
1 2 3
11
12 13 14
15 16 17
18 19 20
r,d2
lok
label2
teste
p*l
test
e
v*varl
test
e
fn*f unci
4
test
e
l,p*l,label2
lok
5 6 7 8 9 10 11
test
e
1.2,label3
lok
test
e
1
test
e
l,fn',funcl,label2
lok
test
e
lok
test
1
test
g
test
ge
1 v'varl label3 1.2,label3 1 1
p*2
,
,p*l
,
label3 p*l label 1
p*l
,
,
,
,
.label
lok
lok
1
,
,
lok
lok
,2,label3
lok
,2,label3
Mllegal
option
Mllegal
SNA
Mllegal
SNA
*
>>
21
Illegal
12
specified
option
1
test
s"l,l,label3 *
>>
22
Operand
13
is
test
not
g
valid
1
,s*l
,label3
*
>>
Operand
14
23
is
test
not e
valid
,1
,label3
[required
operand
missing
[required
operand
missing
*
>>
Required
operands
1
missing
24
15
25 26 27
16
test
g
1,1
!ok
17
test
e
l,l,label4
18
test
1
a,
Mncorrect label I i 1 legal operand
28
19
test
>>
>>
Required
Operand
1,
,label3
operands
is
test
not
missing
1. labell valid
1, a, labell
g
error
Mllegal
operand
*
Operand
>>
29
20
is
test
not
e
valid
v*var2
,p*2
,
label2
*
Undefined
>>
operand *
>> Operand
30
not
valid
end
Symbol
Table Contents
Label
1
:
Label Length Label
is
:
after
attribute: of
First
Pass
Completion
STORAGE 1
information:
varl
Label Length
VARIABLE information: 2
attribute: of
Information
stored:
1: Label
:
fund Label
Number
attribute: of
points
FUNCTION in the function:
0.100000 Length
Label:
0.200000 information:
of
2
1
2 2
labell
70
[undefined
operand
second
pass
Label Label:
number
Simulation *
attribute:
LABEL
attribute:
LABEL
label3 Label
Total
LABEL
label2 Label
Label:
attribute:
of
phase
9
errors
=
will
not
GPSS exiting
occur
due
to
ERRORS
*
71
GPSS VI. 0 J. Van
-
May, 1984
Dellon
author:
1
2 3
Purpose
:
5 6 7
The following program is used for a generic debugging tool The following program for the GPSS compiler/simulator thesis. depicts a traffic problem over a bridge where one lane has been shut through the other lane by means of redirected off and the traffic is a traffic light at each end of the bridge.
8 9
Written
4
10 11 12 13 14
:
Jacky
Parameters
15
4
16
5
March
Van Dellon
1984
15,
: -
keep keep
count
of
cars
count
of
cars
in in
direction
2
direction
1
17
18 19 20
simulate
Traffic
lights
problem
21 22 23
expon
24
0.84,1830/0.88,2120/0.9,2300/0.92,2520/0.94,2810/0.95,2990/0.96,3200/0.97,3500/
25 27 28 29 30 31 32 33
0.98,3900/0.99,4 600/0.995,5300/0.998,6200/0.999,7000/0.9997,8000
function
r,d23
0.0,0/0.1,104/0.2,222/0.3,355/0.4,509/0.5,690/0.6,915/0.7,1200/0.8,1600/
grel
variable
600
length
of
time
gre2
variable
450
length
of
time
stop 1 2
storage
1 30 30
storage
storage storage
traffic
from direction
storage storage
for for
light light
in in
direction 1 direction 2 to restrict flow of transactions used for entering cars in direction 1 used for entering cars in direction 2 green green
1
34
35 36 37 38 39 40 41 42 43 44
45
46 47 48
49 50
51 52 53 54
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
71 72 73 74
90,fn*expon
generate queue
seize gate
u
transfer
nulll
7 8 9 10 11 12 13
delay
[generate cars [enter queue
1 1 1
Iseize starting lis 1 ight green [null transfer
.delay
advance
100
Inull
advance
20
Istart
assign
5,+l 1,1 1 1 1
Ikeep
enter
depart release
leave
14
generate
15 16 17 18
queue
u
test
g
p*5,
19
null2
20 21 22 23 24
around
advance
Igenerate lenter
10,
around
100
Inull
20 4.+1 depart 2 release 2 terminate advance assign
25 26 27 28 29
se
enter
loop
cars
queue
block
start
car
count
cars
in
direction
leave starting release car
counter
is
starting over
2
place place
bridge
lights 1
generate gate
cars
Iseize starting position Ms light 2 green [check for ten cars in the
i
traffic
of
storage
2
120,fn*expon
gate
seize
car
count
[leave queue [release starting place Heave storage Icar is over bridge
from direction
2 2 2
block
[enter
terminate traffic
place
ljust start this sequence up Imake sure only one goes through lone is through and starts cycle
s*stop s*stop
advance
550
seize
1
Iboth lights red Might 1 becomes
72
green
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
30 31 32 33 34 35 36
advance
v*grel
Igreen
time
release
1
Might
one
advance
Iboth
seize
550 2
advance
v*gre2
release
2
transfer
generate
terminate
36000
lone transaction I decrement
1
start
start
end
Symbol
Table Contents
Label
expon
:
after
Label attribute: Number of points
First
104
222 355 509 690 915 1200 1600 1830
2120 2300 2520 2810 2990 3200 3500 3900
0.970000 0.980000 0.990000
4600
5300 6200 7000 8000
0.995000 0.998000 0.999000 0.999700
:
of
23
0
0.960000
Length
Pass Completion
FUNCTION in the function:
0.000000 0.100000 0.200000 0.300000 0.400000 0.500000 0.600000 0.700000 0.800000 0.840000 0.880000 0.900000 0.920000 0.940000 0.950000
Label
Might two turns Ibegin new light
information:
23
grel
Label Length
attribute:
of
VARIABLE 4
information:
Information
stored:
600: Label
:
gre2
Label Length
attribute:
of
VARIABLE 4
information:
Information
stored:
450:
Label
:
stop Label Length
Label:
of
STORAGE 1
information:
1 Label Length
Label:
attribute:
attribute:
of
STORAGE
information:
30
2 Label Length
attribute:
of
STORAGE
information:
red
cycle
clock
auxiliary
38
red
lights red Might 2 becomes green Igreen time for 2
.loop
37
for 1 turns
30
73
per
hour
Label
nul
:
1 1
Label Label
:
:
:
LABEL
attribute:
LABEL
attribute:
LABEL
attribute:
LABEL
around
Label Label
attribute:
null2
Label Label
LABEL
delay Label
Label:
attribute:
loop Label
74
GPSS VI. 0 J. Van
author:
May.1984 Dellon -
1 2
3 4 5 6 7 8 9
parsing test for
an
unconditional
transfer
'
simulate
1
storage
varl
variable
1 1
fund function 0.1.1/0.2,2
r,d2
;
10
transfer
label
I
no
I
syntax
error
*
Required
>> 11
operands
missing
transfer
,
Syntax error labell transfer
,label2
ok
transfer
,label2
ok
error
>>
2 3
12 13 14
4
transfer
Syntax
>>
15
error
end
Symbol
Table Contents
Label
1
:
Label
:
after
First
Pass Completion
STORAGE information: 1
attribute:
Length Label
syntax
of
varl
Label attribute: VARIABLE Length of information: 2 Information
stored:
1: Label
:
fund Label
FUNCTION
attribute:
Number
of
in
points
Label:
2
2
labell Label
Total
function: 1 2
the
0.100000 0.200000 Length of information:
number
LABEL
attribute:
of
errors
Simulation phase will * GPSS exiting
3
=
not
occur
due
to
ERRORS
*
75
error
GPSS VI. 0 May. 1984 J. Van Dellon -
author:
1 2 3 4 5 6 7 8 9 10 11 12
parsing test for VARIABLE
statement
simulate
function fund 0.1,1/0
r,d2
varl
variable
1*2+3-4/5
lok
var2
variable
l+v*varl+3
lok
var3
variable
v*var2+p*l+fn*funcl
lok
var4
variable
p*l-v*var3
var5
variable
v*var5*v*var2
lok Icannot lea
1+2
Irequired
l+*2
[arithmetic
definition
error
l+(2*3)
larithmetic
definition
error
+1*2
larithmetic
definition
error
.2.2
>>
Undefined
13 >>
Label
vara
15
varb
>>
variable
operand
variable
14
same
use
label
missing
required variable
Syntax
error
variable
>>
Syntax
>>
Operand
error *
is
not
16
varc
17
vard
variable
18
vare
variable
>>
valid
variable
Illegal
definition
variable
22+30 2a+3
lok
3
Isyntax
a+b
Mllegal
operand
Mllegal
SNA
Mllegal
operand
*
>>
Syntax
19
var6
20
var7
>>
21
error
variabl
Syntax
error
variable
>>
Syntax
>>
Required
var8
error
error
operands
missing
variable
>>
Syntax
>>
Required
s*2+l
error *
operands
mirsing
22
var9
23 24
varlO varll
25 26 27
varl2
variable
varl3
variable
1-2 1/2
varl4
variable
-1
28 29 30 31 32 33
varl5
variable
-f
varl6
variable
-1/2*3
varl7
variable
varl8
variable
varl9
variable
var20
variable
2/3+4/5+5*6*3 2/3+-4 2/v*var6+-v*var7 l--v*varl3
34
var21
variable
v*varl3*varl4
>>
>>
1,2
larithmetic definition
variable
fn*funcl+2
variable
1
[undefined operand Isyntax error
variable
Syntax
Operand
error
is
not
1
valid
n*f unci
lok lok lok lok lok lok
lok.
>>
37
variable
var23
variable
Illegal
var24
variable
variable
1/-2 l/*23
!ok,
38 39
1-
-(4)
Mllegal
(
-(varl3)) specification
of
variable
lok
larithmetic definition
definition 34*-/34
larithmetic definiton
*
>>
+
Undefined operand
var22
>>
(2/3)
lok
0
35 36
error
Illegal
variable
definition
var25
variable
8*v*var5/v*var22
var26
variable
-v*varl4
76
lok lok
error
error
40
var27
variable
varl4
+
varl5
+
wolf
*
>>
Syntax
>>
Required
error *
41
var27a
operands
missing
variable
zebra *
42 43
>>
Syntax
>>
Required
error
operands
missing
var28
variable
1/2
var29
variable
1+2+3+4+5+6+ *
>> Operand 44
var30
45
end
is
not
valid
variable
65*59/45/64
a**********************************************
Symbol
Table Contents
Label
fund
:
Label
after
attribute:
First Pass Completion
FUNCTION
in the function: 0.100000 1 2 0.200000 Length of information: 2
Number
Label
:
of
points
2
varl
VARIABLE information: 20 Information stored:
Label
attribute:
Length
of
vlt000:3:+:vlt001:-:
Label:
vltOOO
Label
attribute:
Length
of
TEMPORARY
information:
Information
6
stored:
1:2:*: Label:
vltOOl
Label attribute: TEMPORARY Length of information: 6 Information stored: 4:5:/: Label
:
var2
Label Length
attribute:
of
Information
13
stored:
l:varl
Label:
VARIABLE
information: :+:3:+:
var3
Label
attribute:
VARIABLE 17
Length of information: Information stored: var2:
Label
:
1
:+:funcl :+:
vlt002
Label attribute: PARAMETER Information stored:
1 Label
:
var4
Label Length
attribute: of
VARIABLE
information:
Information
9
stored:
l:var3:-:
Label
:
vlt003
Label
attribute:
Information
PARAMETER
stored:
1
77
Label
var5
:
Label Label
attribute:
VARIABLE
attribute:
VARIABLE
vara
:
Label
information: Information stored: 1: Length
Label
of
2
varb
:
Label
VARIABLE information: 2 Information stored: 1: attribute:
Length
Label
varc
:
Label
Label
of
:
attribute:
VARIABLE
vard
Label attribute: VARIABLE Length of information: 8
Information stored: 22:30:+: Label
:
vare
Label attribute: VARIABLE Length of information: 2 Information stored: 2: Label
:
var6
Label Label
:
attribute:
LABEL
attribute:
VARIABLE
attribute:
VARIABLE
var7
Label Label
:
var8
Label Label
:
var9
Label
VARIABLE information: 2 Information stored: 1: Length
Label
:
attribute: of
varlO
Label
attribute:
VARIABLE 10
Length of information: Information stored:
funcl:2:+: Label
:
varll
Label Label
:
attribute:
VARIABLE
varl2
VARIABLE information: 6 Information stored: 1:2:-:
Label
Length
Label:
attribute: of
varl3
Label Length
VARIABLE information: 7
attribute:
of
Information
stored:
vlt004:
Label:
vlt004
Label Length
attribute: of
TEMPORARY
information:
Information
6
stored:
1:2:/: Label
:
varl4
Label Length
attribute:
of
VARIABLE 4
information:
Information
stored:
78
1:-: Label
:
varl5
Label attribute: VARIABLE Length of information: 8 Information stored:
fund:-: Label
:
varl6
Label attribute: VARIABLE Length of information: 7 Information stored: vlt006:
Label:
vlt005
Label
attribute: TEMPORARY Length of information: 8 Information stored:
l:-:2:/: Label:
vlt006
Label
attribute: TEMPORARY Length of information: 11 Information stored: vlt005:3:*:
Label
:
varl7
Label attribute: VARIABLE Length of information: 25
Information
stored:
Vlt007:vlt008:+:vlt010:+:
Label:
vlt007
Label
TEMPORARY information: 6 Information stored: 2:3:/: attribute:
Length
Label:
of
vlt008
Label attribute: TEMPORARY Length of information: 6 Information stored:
4:5:/: Label:
vlt009
Label attribute: TEMPORARY Length of information: 6 Information
stored:
5:6:*: Label
:
vltOlO
Label
attribute:
TEMPORARY
information: Information stored:
Length
of
11
vlt009:3:*:
Label
:
varl8
Label
attribute:
VARIABLE
Length of information: Information stored:
13
vlt011:4:-:+:
Label:
vltOll
Label Length
attribute:
of
TEMPORARY
information:
Information
6
stored:
2:3:/: Label
:
varl9
Label
Length
attribute:
of
VARIABLE
information:
Information
16
stored:
vlt012:var7:~:+:
Label:
vlt012
Label
attribute:
TEMPORARY
79
Length
information:
of
11
Information stored: 2:v*var6:/: Label
var20
:
Label attribute: VARIABLE Length of information: 12 Information stored: l:varl3:-:-: Label
var21
:
Label Label
attribute:
VARIABLE
var22
:
Label attribute: VARIABLE Length of information: 7 Information stored: vlt013:
Label:
vlt013
Label
attribute:
TEMPORARY
Length of information: Information stored:
8
1:2:-:/: Label:
var23
Label
Label:
attribute:
VARIABLE
vlt014
Label attribute: TEMPORARY Length of information: 2 Information
stored:
1: Label
var24
:
Label
Label:
attribute:
VARIABLE
attribute:
TEMPORARY
vlt015
Label
Length of information: Information stored:
3
34: Label
var25
:
Label attribute: VARIABLE Length of information: 7 Information
stored:
vlt017:
Label:
vlt016
Label
attribute:
TEMPORARY
Length of information: Information stored:
8: Label:
11
v*var5::
vlt017
Label
TEMPORARY information: 17
attribute:
Length
of
Information
stored:
vlt016:v*var22:/:
Label
:
var26
VARIABLE information: 8 Information stored:
Label
Length
attribute:
of
varl4:~:
Label
:
var27
Label Label
:
VARIABLE
attribute:
VARIABLE
var27a
Label
Label:
attribute:
var28
Label Length
VARIABLE information: 7
attribute: of
tiO
Information
stored:
vlt018:
Label:
vlt018
Label attribute: TEMPORARY Length of information: 6
Information stored: 1:2:/: Label:
var29
Label attribute: VARIABLE Length of information: 22 Information stored:
l:2:+:3:+:4:+:5:+:6:+: Label
:
var30
Label attribute: VARIABLE Length of information: 7 Information stored: vlt021:
Label:
vlt019
Label attribute: TEMPORARY Length of information: 8
Information stored: 65:59:*: Label
:
vlt020
Label
TEMPORARY information: 12 Information stored: attribute:
Length
of
vlt019:45:/:
Label:
vlt021
Label 'attribute: TEMPORARY Length of information: 12 Information
stored:
vlt020:64:/:
START
card
Total
number
Simulation *
information
of
phase
22
errors
=
will
not
GPSS exiting
*
occur
due
to
ERRORS
8.3.2. Pseudo Code Generator.
Control Statements: SIMULATE
No
pseudo code was generated, which
is
correct.
START
No
pseudo code was generated, which
is
correct.
END
No
pseudo code was generated, which
is
eorrect.
Entity Definition Statements: FUNCTION
No
pseudo code was generated, which
is
correct.
STORAGE
No
pseudo code was generated, which
is
correct.
VARIABLE
No
pseudo code was generated, which
is
correct.
Block Definition Statements:
Correct
pseudo code was generated
for the test
case.
Correct
pseudo code was generated
for the test
case.
DEP A RT
Correct
pseudo code was generated
for the test
case.
ENTER
Correct
pseudo code was generated
for the test
case.
GATE
Correct
pseudo code was generated
for the test
case.
GENERATE
Correct
pseudo code was generated
for the test
case.
LEAVE
Correct
pseudo code was generated
for the test
case.
QUEUE
Correct
pseudo code was generated
for the test
case.
RELEASE
Correct
pseudo code was generated
for the test
case.
SEIZE
Correct
pseudo code was generated
for the test
case.
TERMINATE
Correct
pseudo code was generated
for the test
case.
TEST
Correct
pseudo code was generated
for the test
case.
TRANSFER
Correct
pseudo code was generated
for the test
case.
ADVANCE ASSIGN
,
TRAFFIC. GPS * * *
NOTE the
Correct
following
pseudo code was generated
pages are
case.
the pseudo code generator test results. Due to printing an undefined character. The character is the
the hardware, an underscore is representation for the underscore.
capabilities of
for the test
-
82
GPSS VI. 0 author:
J.
May
.1984
Van Dellon
1 2
!
3
1
i
parsing test for ADVANCE
4
statement
simulate
5 6 7 8 9
1
storage
varl
variable
1 1
fund function 0.1.1/0.2.2 label
r,d2
10
1
11
2
12
3
13 14 15
4
advance
p*l
5 6
advance
P*l
lok, lok,
advance
s*l
Inot allowed SNA
16
7
17
8
advance
v*varl
18 19
9 10
advance advance
20 21 22 23
11
advance
12
advance
13 14
advance
fn*funcl FN*funcl 1
advance
a
24
15
25
16
26 27
17
advance
Required
>>
Operand
Operand
>>
Operand
,>>
is
not
is
is
Required
>>
Syntax
>>
Syntax
>>
>>
Syntax
variable
f*l
linvalid
Syntax
SNA
variable specification
lok,
function
lok,
function
lok [illegal
operand
valid
[required
,
operand
missing
1.
Isyntax
400
!ok Isyntax
error
error
error
Mllegal
label
error
1
of
valid
error
advance
>>
parameter
lok, lok,
advance
18
parameter
valid
advance
#
%$operand
valid
operands
advance ,
Mllegal
V*varl
not
advance
operand
allowed
not
advance
I il legal
Inot
not
missing
valid
pl
is not valid S*l
is
Operand
>>
30
not
operand
missing
PI
advance
>> Operand
29
is
advance
>> Operand
28
operands
advance
>>
[required
Isyntax
1
error
end
83
error
missing
function
Symbol
Table Contents
Label:
1 Label
:
First Pass Completion
STORAGE information: 1
attribute:
Length Label
after
of
varl
Label
VARIABLE information: 2
attribute:
Length
of
Information
stored:
1: Label:
Label:
fund Label attribute: FUNCTION Number of points in the function: 0.100000 1 0.200000 2 Length of information: 2 label Label
Label:
attribute:
LABEL
attribute:
PARAMETER
vltOOO
Label
Information 1 Label:
2
stored:
vltOOl
Label
attribute:
Information
PARAMETER
stored:
'l Label:
vlt002
Label
attribute:
Information 1 Label:
CONSTANT
stored:
vlt003
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt004
Label
attribute:
Information 400 Label:
CONSTANT
stored:
vlt005
Label
attribute:
Information 1
CONSTANT
stored:
84
START
information
card
Pseudo Code Generated
ADVANCE 3
operator:
block
number
-
A
valid
I invalid A-operand
+1.2
assign
Required
operands
missing Icomma
l+,2
assign
not
in
proper
*
>>
21
12
22
13
23
14
24
15
25
16
Required
operands
assign
>>
Syntax
missing
1.-
Ino
a,-l
[illegal
A-operand
-Mllegal
B-operand
error
'
assign
>> Operand
is
Operand
is
assign
>> Operand
not
valid
1,+b
assign
>>
specified
numeric
not
valid
s*l,+l
is
not
SNA
Mllegal
SNA
valid
l,-s*l
assign
Mllegal
*
>>
26
17
27
18
Operand
is
assign
>>
not
valid
v*var2,+l
Undefined
*
>>
Undefined
>>
Operand
operand *
28
end
is
operand
[undefined
operand
operand
l.+v*var2
assign
lundefined
not
valid
place
arithmetic
Symbol
Table Contents
Label:
1
after
First Pass Completion
Label attribute: STORAGE Length of information: 1 Label
varl
:
Label
attribute: VARIABLE Length of information: 2 Information stored:
1: Label
fund
:
Label
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2 attribute:
Number
Label:
of
points
2
vltOOO
Label attribute: PARAMETER Information stored: 1 Label
:
vltOOl
Label
attribute:
Information
CONSTANT
stored:
-1
Label:
vlt002 Label'
attribute:
Information
PARAMETER
stored:
1 Label:
vlt003
Label attribute: CONSTANT Information stored:
2 Label
:
vlt004
Label attribute: CONSTANT Information stored: -1
Label:
vlt005
Label attribute: CONSTANT Information stored:
2 Label:
vlt006
Label attribute: PARAMETER Information stored:
1 Label:
vlt007
Label attribute: PARAMETER Information stored:
1 Label:
vlt008
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt009
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vltOlO
Label
Length
attribute:
of
CONSTANT
information:
1
87
Label:
vltOll
Label
attribute:
Information 1 Label:
PARAMETER
stored: i
vlt012
Label attribute: PARAMETER Information stored: 1 Label:
vlt013
Label
attribute:
Information 1 Label
:
PARAMETER
stored:
vlt014
Label attribute: CONSTANT Information stored: -1
Label:
vlt015
Label
attribute:
Information 1 Label:
PARAMETER
stored:
vlt016
Label attribute: CONSTANT Information stored:
1 Label
:
vlt017
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt018
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt019
Label
attribute:
Information 1
PARAMETER
stored:
START
Pseudo
Code Generated
operator:
block
information
card
ASSIGN
number
=
0
A>
>>
13 14
3 4
15
5
16
6
17
7
18 19
6 9
Required operands missing 1 depart depart a is not depart a,
is not depart
>>
required
operand
missing
lok
!A-operand
not
valid
B-operand
valid
I
required
[illegal
is not valid depart v*a,v*b
lok,
depart
Mllegal
operand
missing
specification
of
pi
variable
SNA's
specifications
operand
valid
[multiple labels
defined label depart l,v*b depart v*a,2 depart s*l
Multiply
10 11 12
>> Operand
25
definition
queue
Operand
>> Undefined
24
good
Imissing
Required operands missing depart a.b
>> Operand is not label departr 1 >>
a
valid
,
>>
Inot
I
>> Operand
20
r,d2
valid
>> Operand
21 22 23
statement
13
operand
is
depart end
lok lok Inot defined SNA
not
valid
p*l.l
lok,
correct
specification
Symbol
Table Contents
Label
a
:
Label
First Pass Completion
VARIABLE information: 2
attribute:
Length
of
Information 1: Label:
after
stored:
b Label attribute: VARIABLE Length of information: 2 Information
stored:
1: Label
:
storl
Label attribute: STORAGE Length of information: 20 Label:
fund Label
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2 attribute:
Number
Label:
Label:
label Label
of
points
attribute:
LABEL
attribute:
CONSTANT
2
vltOOO
Label
Information
stored:
1
Label:
vltOOl
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt002
Label
attribute:
Information
CONSTANT
stored:
1 Label
:
vlt003
Label attribute: CONSTANT Information stored:
2 Label:
vlt004
Label attribute: PARAMETER Information stored: 1
Label:
vlt005
Label attribute: CONSTANT Information stored: 1
91
START
card
information
Pseudo Code Generated
operator:
block
DEPART 2
number
A-operand=
vltOOO
B>
>>
allowed
statement
end
9
operands
valid
endd
8
START
Ino
a
Ino
not
allowed
allowed
First
after
label
Pass Completion
LABEL
attribute:
information
Pseudo Code Generated
Total
number
Simulation
of
4
errors will
phase
not
occur
due
to
ERRORS
GPSS exiting
GPSS VI. 0 May, 1984 J. Van Dellon I -
author:
1 2 3
I
parsing
I
SECOND
test of
for
THREE
END test
statement routines
I
4
5 g
simulate
end
>>
>>
is
Operand
#$
7
Isyntax
,b
not
valid
(illegal
end
Syntax
o
Syntax
Isyntax
error
Pseudo Code Generated
3 Total number of errors Simulation phase will not occur due to ERRORS * GPSS exiting -
May, 1984 GPSS VI. 0 J. Van Dellon -
*
author:
label
error
9ncj
>>
error
93
error
due to comma
parsing test for END THIRD
of
THREE
test
statement routines
simulate
lok
end
Pseudo Code Generated
94
GPSS VI. 0 May, 1984 J. Van Dellon I I parsing test for ENT 1
author:
1 2 3 4
simulate
5 6 7 8 9 10 11 12
a
variable
b
variable
storl
storage
function fund 0.1.1/0.2,2 I 1 2
enter
label >>
14
3 4
15
5
16
6
17
7
18
8 9
13
>>
Required
storage
Irequired
operands
lok
a
!A-operand
is not
Operand
Required
Operand
not
valid
valid
IB-operand missing
a.
is not
valid
Irequired
,
operands
is
specification
missing
missing
enter
Operand
label
operand
1
enter
>>
"lok.
s*storl
enter
enter
>>
r.d2
enter
enter
>>
19
1 1 20
missing
missing Mllegal
a.b
not
operand
specification
of
valid
enter
v*a,v*b
lok.
enter
pi
I illegal
variable
specifications
operand
*
Operand is not enterr 1 label >>
20
>>
21 22
23
>>
25
[multiple
labels
enter
l,v*b
lok
enter
v*a,2
enter
s*l
lok Inot
defined SNA
lok.
correct
Undefined operand
>> Operand
24
valid
Multiply defined label
10 11 12
13
is
enter
not
SNA's
valid
p*l,l
end
95
specification
Symbol
Table Contents
Label
a
:
Label
after
attribute:
First
VARIABLE
information: Information stored: 1:
Length
Label:
Pass Completion
of
2
b
Label
VARIABLE information: 2 Information stored: 1: attribute:
Length
Label:
storl
Label
STORAGE information: 20
attribute:
Length Label:
of
of
fund Label attribute: Number of points
FUNCTION in the function:
0.100000 0.200000 Length of information: Label:
2
1 2 2
vltOOO
Label
attribute:
Information
CONSTANT
stored:
1
Label:
Label:
label Label
attribute:
LABEL
attribute:
CONSTANT
vltOOl
Label
Information 1 Label:
stored:
vlt002
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt003
Label
attribute:
Information
CONSTANT
stored:
1
Label:
vlt004
Label
attribute:
Information
CONSTANT
stored:
2 Label:
vlt005
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt006
Label
attribute:
Information
CONSTANT
stored:
1
96
START
card
information
Pseudo Code Generated
operator:
block
ENTER
number
0
-
A-operand=
storl
B-operand=
vltOOO
operator:
block
ENTER
number
2
=
A-operand=
vltOOl
B
7
>>
8 *n
9
.5,
Illegal 5/. 8, 8
rl.d2
specification
>> Syntax error functi func2
label
of
function
Mllegal
r,d2
faulty function definitio
line due to
specification
>> Syntax error
10 *n
11
12
13
.5,
5/. 8, 8
lerror
>> Syntax error func3 function
Mllegal
r.d
>>
Illegal
specification
of
numeric
>>
Illegal 5/. 8, 8
specification
of
operand
,.5.
>>
Illegal
specification
of
numeric
of
operand
faulty
specification
on
Mllegal
r,d*2
line due to
of
function definitio
discrete function
quantity
lerror
Syntax error func4 function
on
line due to
specification
faulty
of
function definiton
discrete function
quantity
*
>> 14
.5,
Illegal 5/. 8. 8
specification
lerror
on
line due
to
faulty function
definitio
*n
15 16 17 I8
>> Syntax error func5 function 5/. 8. 8 func6 function
r,d2
lok
r,d2
lok lok
.5.
1,2/3,4
Mllegal
specification
*
19 20 21 22
23 24
25 26
>> Syntax error func7 function 0.5. 5/. 6, 6 func8 function 5/. 6. 7
lok lok tok
r,d2
r.d2
Ityping
.5,
>> Syntax error func9 function 2, 3/. 4, 7 funclO function
r,d3
lok
r.d3
lok lok lok
.1,1/.
.1.1/0.4,4/0.85.7
98
error
due to
random
number
Symbol
Table Contents
Label:
fund
Label
:
Label:
Label
:
:
attribute:
("UNCTION
lfunc Label
attribute:
LABEL
func2 Label
attribute:
LABEL
attribute:
FUNCTION
attribute:
FUNCTION
:
attribute:
FUNCTION
f unc4
func5 Label Number
of
points
in
function: 5 8
the
0.500000 0.800000 Length Label
:
of
information:
Label
2
attribute:
of
points
FUNCTION in the function:
0.000000 Length
func7 Label Number
of
information:
attribute:
of
points
2
FUNCTION in the function:
0.600000 information:
of
2
func8 Label Number
attribute:
of
points
FUNCTION in the function:
0.600000 Length
:
of
information:
2
f unc9 Label Number
attribute:
of
points
FUNCTION
in
function:
the
0.100000
1
0.200000
3 7
0.400000 Length
Label:
2
5 0
0.500000
Label
2
5 6
0'. 500000 Length
2
0 0
0.000000
Label:
2
func6 Number
Label:
Pass Completion
f unc3
Label
Label
First
Label
Label Label
after
of
information:
3
3
funclO Label Number
attribute:
of
points
0.100000 0.400000 0.850000 Length
of
FUNCTION
in the function: 1 4 7
information:
3
3
99
START
card
information
Pseudo Code Generated
>>
No
END
statement
encountered
Total number of errors 15 Simulation phase will not occur due
to
ERRORS
GPSS exiting
100
GPSS VI. 0 author:
1 2
May. 1984 Van Dellon
J. I I
3 4 5 6 7
parsing test for GATE simulate
8 9
1
storage
varl
variable
r.d2
labell
s*l.label2
I invalid SNA
lok
1
11
2 3
label2
gate
u
label3
gate
u
4
label4
gate
u
5
label5
>>
6 7
gate
Operand
18 19 20 21 22 23
8 9 10 11 12 13 14
15
25
16
valid
gate
u
gate
u
1
lok,
gate
nu
s*l,label2
I invalid SNA
lok lok
.
v'varl
is not
,
lok lok
lok shouldn't
nu
fn'funcl, label2
gate
nu
v'varl, labe!2
gate
nu
p*l,label2
gate
nu
1, labell
lok lok
gate
nu
1
lok.
gate
sf
gate
sf
s*l, labell p*l, labell
lok Mllegal
SNA
v*varl. label 1
Mllegal
SNA
Mllegal
SNA
is
Operand
not
is
not
until
true
shouldn't
move
until
true
move
until
true
move
until
true
valid
sf
valid
fn*funcl
sf
gate
move
valid
gate
gate
>>
not
fn*funcl Iabel3 label4 p*l, labell 1, labell
>> Operand
24
u
is
>> Operand
17
1 1
fund function 0.1.1/0.2,2
10
12 13 14 15 16
statement
.label
1
*
>> Operand
is
not
valid
26
17
gate
sf
s*l
lok,
27 28
18
gate
se
s*l, labell
19
gate
se
lok Mllegal
SNA
Mllegal
SNA
Mllegal
SNA
p*l, labell
shouldn't
*
>>
29
20
30
21
31 32
22 23
33
24
34
35
25 26
36
27
37
28
38 39
29 30
40
31
41
32
Operand
is
>> Operand
is
is
valid v*varl
,
label 1
valid
s*l
lok,
sf
1.1
Mllegal
SNA
s*l.l
Mllegal
label
Illegal
is
not
shouldn't
valid
sf
specification
of
label
gate
snf
s*l, labell
lok
gate
snf
p*l, labell
Mllegal
SNA
Mllegal
SNA
fn'funcl, labell
Mllegal
SNA
s*l, labell pM. labell
lok
Mllegal
SNA
fn*funcl, label 1
Mllegal
SNA
Mllegal
SNA
Operand
>> Operand
is
is
gate
>> Operand
is
not
not
not
gate
sne
is
Operand
is
gate
Operand
is
v*varl, label
not
valid
valid
sne
not
valid
v"varl, label
sne
not
1
valid
snf
sne
gate
valid
snf
gate
>> Operand
>>
not
label 1
gate
gate
>>
not
,
se
gate
>>
fn*f unci
gate
>> Operand
>>
valid
se
gate
>> Operand
not
se
gate
1
valid
101
42
33
43
34
44
35
gate
>> Operand
>>
Illegal
Illegal
not
val
ru
option
1.1
Mllegal
SNA
s*l.l
Mllegal
label
id
snf
specification
gate
>>
45
is
gate
snf
of
label
1, labell specified
end
102
Mllegal
mneumonic
Symbol
Table Contents after First
Label:
1 Label Length
Label
:
Pass Completion
STORAGE information: 1
attribute: of
varl
Label Length
VARIABLE information: 2
attribute: of
Information
stored:
1: Label
:
fund Label
attribute:
FUNCTION
in the function: 1 0.100000 0.200000 2 Length of information: 2
Number
Label:
Label:
Label:
attribute:
LABEL
label2 Label
attribute:
LABEL
attribute:
LABEL
attribute:
LABEL
attribute:
PARAMETER
2
label3
1abel4 Label
Label:
points
labell Label
Label
Label:
of
vltOOO
Label
Information
stored:
1 Label:
Label:
label5 Label
attribute:
LABEL
vltOOl
Label attribute: CONSTANT Information stored:
1 Label:
vlt002
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt003
Label
Length
Label:
attribute:
of
LABEL
information:
1
vlt004
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt005
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt006
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt007
Label Length
attribute:
of
LABEL
information:
1
103
Label:
vlt008
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt009
Label
Label:
LABEL information:
attribute:
Length
of
vltOlO
Label
attribute:
Information 1 Label:
attribute:
Length
of
LABEL
information:
1
vlt012
Label
attribute:
Information 1 Label:
PARAMETER
stored:
vltOll
Label
Label:
1
CONSTANT
stored:
vlt013
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt014
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt015
.
Label attribute: CONSTANT Information stored: 1
104
START
information
card
Pseudo Code Generated
U
operator:
block
1 fund NULL
number
A> Operand
21 22 23
for LEA
operand
missing
specification
of
valid variable
specifications
operand
valid
[multiple
defined label leave l,v*b leave v*a,2 leave s*l
labels
Multiply
10 11 12
lok lok
Inot defined SNA
*
>>
Undefined operand *
>> Operand
24 25
is leave
13
not
SNA's
valid
p*l,l
lok,
end
112
correct
specification
Symbol
Table Contents
Label
a
:
Label
after
attribute:
Length
First Pass Completion
VARIABLE 2
information:
of
Information
stored:
1: Label
:
b Label
attribute:
VARIABLE 2
Length of information: Information stored: 1: Label:
storl
Label
Label:
STORAGE information: 20
attribute:
Length
of
fund Label attribute: Number of points
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2 Label:
2
vltOOO
Label
attribute:
Information
CONSTANT
stored:
1 Label:
label Label
Label:
attribute:
LABEL
attribute:
CONSTANT
vltOOl
Label
Information
stored:
1 Label:
vlt002
Label
attribute:
Information
CONSTANT
stored:
1 Label:
vlt003
Label attribute: CONSTANT Information stored: 1
Label:
vlt004
Label
attribute:
Information
CONSTANT
stored:
2
Label:
vlt005
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt006
Label
attribute:
Information
CONSTANT
stored:
1
113
START
card
information
Pseudo Code Generated
LEAVE
operator:
block
0
number
A-operand=
storl
B-operand=
vltOOO
operator:
block
LEAVE 2
number
A-operand =
vltOOl
B-operand=
vlt002
operator:
block
LEAVE
number
A>
14
3 4
15
5
16
6
17
7
18
8 9
13
>>
1
queue
a
Operand
Operand
Operand
label >>
25
missing lok Mllegal
not
A-operand
valid
Ino B-operand
a, not
valid
Irequired
,
operand
missing
Required operands missing
is
Mllegal
a.b
not
v*a,v*b
lok,
queue
pi
Mllegal
is
queuer
Multiply
not
specification
variable
valid
[multiple
1
defined label l,v*b
labels
queue
queue
v*a,2
lok lok
12
queue
s*l
Inot defined SNA
>>
Undefined operand
>>
Operand
is
queue
not
SNA's
specifications
operand
10 11
13
of
valid
queue
>> Operand
24
is
queue
>>
21 22 23
is
queue
>>
20
operands
queue
queue
>>
19
Required
valid
lok,
p*l.l
end
115
correct
specification
Symbol
Table Contents
Label
a
:
Label
after
First
Pass Completion
VARIABLE information: 2 Information stored: 1: attribute:
Length
Label
:
of
b Label
VARIABLE information: 2 Information stored: 1: attribute:
Length
Label
:
storl
Label
:
STORAGE information: 20
attribute:
Length Label
of
of
fund Label attribute: Number of points
FUNCTION in the function:
0.100000 0.200000 Length of information: Label:
attribute:
LABEL
attribute:
CONSTANT
vltOOO
Label
Information 1 Label:
2
label Label
Label:
2
1 2
stored:
vltOOl
Label
attribute: CONSTANT Information stored: 1
Label:
vlt002
Label
attribute: CONSTANT Information stored: 1
Label:
vlt003
Label
attribute:
Information 2 Label:
CONSTANT
stored:
vlt004
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt005
Label attribute: CONSTANT Information stored: 1
116
START
information
card
Pseudo Code Generated
QUEUE
operator:
block
number
-
2
A-operand=
vlt002
B-operand=
b
operator:
block
QUEUE
number
-
10
A-operand=
a
B>
>>
release
Required
la >>
Illegal
lok
a
Inot
not
Operand
is
Isyntax
Irequired
.1
is
Mllegal valid
parameter
release
s*l
Inot
allowable
SNA
Inot
allowable
SNA
lok, lok,
variable
V*jacky f*l
(facility
not
is
is
not
Syntax
valid
variable
not
valid
lok, lok, lok, lok, 1
function function parameter
parameter
Isyntax
error
Isyntax
error
error
release
>> Syntax error O/W release
Mllegal
*
>> Syntax error
32
parameter
valid
S'l
not
release
,
specification
lok, lok.
is
missing
missing
PI
not
operand
P*l
Operand
SNA
error
release
Operand
of
valid
1,
p*l
>> Operand
>>
specification
release
release
>>
Mllegal
operands
release
>>
SNA
error
Required
Operand
allowed
valid
pi
not
release
}>
label
release
release
>>
of
1
is
missing
label
Mllegal
specification
Operand
operand
missing
2
release
>> Syntax
31
operands
release
release
>>
30
statement
end
118
label
allowed
of
SNA
Symbol
Table Contents
Label:
1 Label
STORAGE information: 1
of
jacky Label
VARIABLE information: 2
attribute:
Length
of
Information 1: Label
:
First Pass Completion
attribute:
Length
Label:
after
stored:
fund Label
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2 attribute:
Number
Label:
Label
:
Label:
of
points
label Label
attribute:
LABEL
la Label
attribute:
LABEL
attribute:
CONSTANT
vltOOO
Label
Information 1 Label:
2
stored:
vltOOl
Label
attribute:
Information-
CONSTANT
stored:
1
Label:
vlt002
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt003
Label attribute: PARAMETER Information stored: 1
Label:
vlt004
Label
attribute:
Information 1
Label:
PARAMETER
stored:
vlt005
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt006
Label attribute: CONSTANT Information stored: 1
119
information
START card
Pseudo Code Generated
RELEASE
operator:
block
2
number
A-operand=
vltOOO
B-operand=
NULL
RELEASE 8
operator:
block
number
-
A>
seize
p*l
P*l
lok, lok,
parameter
seize
seize
s*l
Inot
allowable
SNA
Inot
allowable
SNA
lok. lok,
variable
V*jacky f*l
[facility
Operand
Operand
>> Operand
is
not
not
valid
FN*funcl
seize
fn*funcl
seize
p*l
P"l
20
seize
1
Syntax
Syntax
0##
lok. lok. 1
parameter parameter
Isyntax
error
Isyntax
error
error
error
Mllegal
seize
Syntax
not
lok, function lok. function
seize
,
variable
valid
seize
seize
>>
32
is
parameter
valid
S*l
18
>>
31
not
19
>>
30
is
seize
>>
SNA
error
* >
of
valid
1,
seize
>>
allowed
valid
pi
seize
label
label
seize
>> Operand
>>
of
Mllegal
error
end
121
label
allowed
of
SNA
Symbol
Table Contents
Label:
1 Label
attribute:
Length Label:
after
of
First
Pass Completion
STORAGE 1
information:
jacky Label
attribute:
Length
of
VARIABLE
information:
Information
2
stored:
1: Label:
fund Label
attribute:
Number
of
points
FUNCTION in the function:
Length Label:
Label
:
Label:
of
2
1 2
0.100000 0.200000
information:
2
label Label
attribute:
LABEL
la Label
attribute:
LABEL
attribute:
CONSTANT
vltOOO
Label
Information
stored:
1 '
Label:
vltOOl
Label attribute: CONSTANT Information stored:
1 Label:
vlt002
Label attribute: PARAMETER Information stored: 1 Label:
vlt003
Label
attribute:
Information 1 Label:
PARAMETER
stored:
vlt004
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vlt005
Label
attribute:
Information
PARAMETER
stored:
1
Label:
vlt006
Label attribute: CONSTANT Information stored:
1
122
START card
information
Pseudo Code Generated
SEIZE
operator:
block
2
number
A-operand=
vltOOO
B Operand
statement
routines
not
valid
[misspelling
simulatte
>>
Label
valid
but
no
>>
statements
[no
simulate
Label
not
label
[duplicate simulate
Multiple SIMULATION
label
as
statement
simulate
>>
take
label
allowed
allowed
end
Symbol
Table Contents
Label:
label Label
START
card
after
First
Pass Completion
LABEL
attribute:
information
Pseudo Code Generated
Total number of errors 4 Simulation phase will not occur due to
ERRORS
GPSS exiting GPSS VI. 0 May. 1984 J. Van Dellon -
author-
parsing test for SIMULATE SECOND
of
simulate
>> Syntax #$
THREE test
statement
routines
Isyntax
,b
error
error
simulate
Mllegal
label
*
>>
Syntax
error
simulate
>> Syntax
Isyntax
6rror
end
Pseudo Code Generated
Total number of errors 3 Simulation phase will not occur due to ERRORS GPSS exiting -
GPSS VI. 0 author:
J.
May. 1984 Van Dellon
124
error
due to comma
1 2 3 4 5 6
I I I I
parsing test for SIMULATE statement THIRD
of
THREE test routines
simulate
|0k
end
Pseudo Code Generated
125
GPSS VI. 0 May. 1984 J. Van Dellon I I parsing test for START -
author:
1
2 3 4
5 6
simulate
I label >>
7
statement
I
Mabel
start
1
not
allowed
Label
Isyntax
start
,
not
allowed
error
*
>>
Syntax
8 9 >>
error
start
1
start
a
Undefined
10
Required
operand
operand
start
>>
lok Mllegal
Irequired
,NP,3
operands
operand
missing
11 12
start
l.np
lok
start
1,,
Isyntax
13
start
l.,c
Mllegal
operand
lok lok Mllegal
option
>>
Undefined start
1..2
15 16
start
l.NULL l.bb
>>
Operand
17 >>
18
is
not
start
1
Syntax
correct,
operand
14
start
missing
valid
np
1
error
end
126
Isyntax
error
just
no
arguements
Symbol
Table Contents
Label:
label Label
attribute:
START card
information
START
#1:
card
after
card
#2:
LABEL
time 1 interval printout
simulation
NO SNAP START
First Pass Completion
time 1 interval printout Interval printout time
requested
simulation
SNAP
requested
is 2
units
Pseudo Code Generated
Total number of errors * 7 Simulation phase will not occur due
to ERRORS
GPSS exiting
12 7
May. 1984 GPSS VI. 0 J. Van Dellon I I parsing test for STORAGE I -
author-
1
2 3 4 5 6
statement
simulate
I
Imissing
storage
>>
Label
label
required
lok
7
a
storage
8 9
1
storage
2 3
!ok
la
storage
4
jok
>>
Illegal
specification
of
numeric
>>
Illegal
specification
of
label
quantity
[duplicate
5
label
10
1
11
2
12
3
13
>> Operand is not valid 4 storage 7,
Isyntax
error
14
>> Syntax error 5 storage 8,9
Isyntax
error
Isyntax
error
Isyntax
error
>>
>>
>>
15
,
storage
Multiply defined label [required operand missing
storage
Required
operands
storage
Syntax
6
missing Mllegal
six
operand
error
storage
11
10 *
>> Syntax error
16
17
>> Syntax error $%tt storage >>
18
storage
,
Syntax
1
Mllegal
error
end
128
label
Symbol
Table Contents
Label
a
:
Label Length
Label:
Length :
Label:
Label:
Label :
of
STORAGE information: 3
attribute: of
Label
attribute:
STORAGE
Label
attribute:
STORAGE
Label
attribute:
STORAGE
Label
attribute:
2
3
4 of
STORAGE information: 7
5 Label Length
Label:
STORAGE information: 2
attribute:
la
Length Label:
First Pass Completion
1 Label
Label
after
STORAGE information: 8
attribute: of
6 Label Length
attribute: of
STORAGE 10
information:
129
START
card
information
Pseudo Code Generated
Total
number
of
errors
Simulation phase will GPSS exiting
-
not
11 occur
due to
ERRORS
130
GPSS VI. 0 May. 1984 J. Van Dellon -
author:
i i
1 2 3
!
parsing test for TERI
i i
4
simulate
5 6 7 8 9 10 11 12 13
1 2 3 4
14
5
15
6
1
storage
varl
variable
1
1
function fund 0.1,1/0.2.2
r.d2
i
i
label
terminate
lok
terminate terminate
lok, 1
terminate
>> Syntax
Isyntax
1
error
error
terminate
Operand
>>
default
lok
1s
not
val
a
Mllegal
2,
Isyntax
error
3
Isyntax
error
5
lok [misspell ing,
operand
id
terminate CCt
Syntax
>>
16
7
17 18
8
error
terminate Syntax error terminate termlnatte
>>
Label
>>
19
no
statement
terminate >>
20
9##
9
22
10
23
11
24
12
25
13
26
14
27
15
28
16
29
17
30
18
Isyntax
Syntax error terminate
>> Syntax
21
is
not
1s
not
1s
not
is
not
Operand
is
not
Operand
is
not
1s
not
1s
not
is
not
1s
not
Ino SNA's
allowed
P*l
Ino SNA's
allowed
s*l
Ino SNA's
allowed
S*l
Ino SNA's allowed
v*l
Ino SNA's
allowed
V*l
Ino SNA's
allowed
fn*l
Ino SNA's
allowed
FN*1
Ino SNA's allowed
valid
valid
terminate
>> Operand
p*l
valid
terminate
>> Operand
operand
valid
terminate >> Operand
Mllegal
valid
terminate >> Operand
pi
valid
terminate >>
operand
valid
terminate
>>
! illegal
valid
terminate >> Operand
PI valid
terminate >> Operand
label
error
terminate >> Operand
error
illegal
terminate >> Operand
31
but
valid
error
valid
end
131
Symbol
Table Contents
Label:
1 Label
:
First Pass Completion
STORAGE information: 1
attribute:
Length
Label
after
of
varl
Label attribute: VARIABLE Length of information: 2
Information 1: Label:
stored:
fund Label
FUNCTION in the function: 0.100000 1 0.200000 2 Length of information: 2 attribute:
Number
Label:
Label:
label Label
of
points
attribute:
2
LABEL
vltOOO
Label
attribute: CONSTANT Information stored: 1
Label:
vltOOl
Label
attribute: CONSTANT Information stored:
1
Label:
vlt002
Label
attribute:
Information 1 Label:
vlt003
Label
attribute:
Information 2 Label:
CONSTANT
stored:
vlt004
Label
attribute:
Information 3 Label:
CONSTANT
stored:
CONSTANT
stored:
vlt005
Label
attribute:
Information 5
CONSTANT
stored:
132
START
card
information
Pseudo Code Generated
operator:
block
TERMINATE = 0
number
A> Operand
22
13
is
test g
val id l.s*l.label3 *
>>
23
14
24
15
Operand
is
not
test e >>
Required
'
valid
,l,label3
Irequired
operand
missing
Irequired
operand
missing
operands
1
test
missing l,,label3 *
>>. Required 25 26 27
16 17 18
operands
test g test e test
1
missing
1,1 l,l,label4 a.
lok
Mncorrect label Mllegal operand
1. labell
error
*
>>
28
Operand is
19
not
test g
1,
valid
a, labell
Mllegal
operand
*
>>
29
Operand
20
is
not
test e
>>
Undefined
valid
v*var2.p*2
,
label2
operand *
>> Operand 30
is
not
valid
end
134
[undefined
operand
second
pass
Symbol
Table Contents
Label
1
:
after
First
Pass Completion
Label attribute: STORAGE Length of information: 1 Label
:
varl
Label
attribute:
VARIABLE 2
Length of information: Information stored: 1: Label
:
fund Label
attribute:
Number
of
points
FUNCTION in the function:
0.100000 0.200000 Length
Label:
Label:
labell Label
of
2
1
2
information:
2
attribute:
LABEL
attribute:
PARAMETER
vltOOO
Label
Information
stored:
1 Label:
vltOOl
Label
attribute:
Information '
Label:
Label:
labe12 Label
PARAMETER
stored:
2
attribute:
LABEL
vlt002
Label attribute: PARAMETER Information stored:
1 Label:
Label:
label3 Label
attribute:
LABEL
attribute:
PARAMETER
vlt003
Label
Information
stored:
1 Label:
vlt004
Label attribute: CONSTANT Information stored:
1
Label:
vlt005
Label attribute: PARAMETER Information stored:
1
Label:
vlt006
Label attribute: CONSTANT Information stored:
1
Label:
vlt007
Label attribute: CONSTANT Information stored:
2
Label:
vlt008
Label
attribute:
Information
CONSTANT
stored:
1
135
Label:
vlt009
Label
attribute:
Information
PARAMETER
stored:
1 Label:
vltOlO
Label attribute: CONSTANT Information stored:
1 Label:
vltOll
Label attribute: CONSTANT Information stored: 1 Label:
vlt012
Label
attribute:
Information 1 Label:
CONSTANT
stored:
vlt013
Label
attribute:
Information
CONSTANT
stored:
2 Label:
vlt014
Label attribute: CONSTANT Information stored: 1 Label:
vlt015
Label attribute: CONSTANT Information stored: '
Label:
2
vlt016
Label attribute: CONSTANT Information stored: 1
Label:
vlt017
Label attribute: CONSTANT Information stored: 1
Label:
vlt018
Label
attribute:
Information 1 Label:
vlt019
Label
attribute:
Information 1 Label:
CONSTANT
stored:
vlt020
Label Length
Label:
CONSTANT
stored:
attribute-
of
LABEL
information:
'-
1
vlt021
Label
attribute:
Information
CONSTANT
stored:
1
Label:
vlt022
Label
attribute:
Information
CONSTANT
stored:
1
Label:
vlt023
Label
attribute:
Information
CONSTANT
stored:
1
136
START >
card
information
Undefined label
label4
Pseudo Code Generated
operator:
block
EQ
number
0
=
A>
Undefined
operand
35 36
var22
variable
1/-2
!ok
var23
variable
l/*23
[arithmetic
definition
37
var24
[arithmetic
definiton
38 39
var25
variable
var26
variable
>>
>>
Illegal
variable
variable
Illegal
variable
error
definition 34*-/34 definition 8*v*var5/v*var22
lok
-v*varl4
lok
151
error
40
41
var27
>>
Syntax
>>
Required
var27a
varl4
variable
+
varl5
Mllegal
spec
of
variable
+
wolf
Mllegal
spec
of
whatever
error
operands
missing zebra
variable *
>>
Syntax
>>
Required
error
operands
missing
lok
42
var28
variable
1/2
43
var29
variable
1+2+3+4+5+6+
[not ok,
hanging
arithmetic
*
>>
Operand
44
var30
45
end
is
not
variable
valid
65*59/45/64
152
lok,
((65*59)/45)/64
operator
Symbol
Table Contents
Label :
fund Label
First Pass Completion
after
attribute:
FUNCTION
in the function: 0.100000 1 0.200000 2 Length of information: 2
Number of
Label
points
2
varl
:
Label
VARIABLE information: 20
attribute:
Length
of
Information
stored:
vlt000:3:+:vlt001:-:
Label:
vltOOO
Label
TEMPORARY information: 6
attribute:
Length
of
Information
stored:
1:2:*: Label:
vltOOl
Label attribute: TEMPORARY Length of information: 6 Information
stored:
4:5:/: Label
var2
:
Label
attribute:
VARIABLE
Length of information: Information stored:
15
l:v*varl:+:3:+:
Label:
var3
Label
attribute:
VARIABLE 24
Length of information: Information stored:
v*var2:p*l:+:fn*funcl:+:
Label
vlt002
:
Label attribute: PARAMETER Information stored:
1 Label
var4
:
Label
attribute:
Length
of
VARIABLE
information:
Information
p*l: v*var3:
Label
13
stored: -:
vlt003
:
Label
attribute:
Information
PARAMETER
stored:
1 tabel:
var5
Label
Label
:
attribute:
VARIABLE
attribute:
VARIABLE
vara
Label
Length
of
information:
Information
2
stored:
1: Label
:
varb
Label Length
,.,
attribute:
of
Information
r
VARIABLE
information:
2
stored:
1: Label
:
varc
Label
,,...
c
attribute:
VARIABLE
15 3
Label
vard
:
Label
attribute:
Length
VARIABLE
information:
of
Information
8
stored:
22:30:+: Label
vare
:
Label
attribute:
VARIABLE
Length of information: Information stored:
2
2: Label:
var6
Label Label
Label
attribute:
VARIABLE
attribute:
VARIABLE
attribute:
VARIABLE 2
var8
:
Label Label
LABEL
var7
:
Label
attribute:
var9
: -
Label
Length of information: Information stored:
1: Label:
varlO
Label
attribute:
VARIABLE 13
Length of information: Information stored: fn*funcl:2:+: Label
:
varll
Label Label
:
attribute:
VARIABLE
attribute:
VARIABLE 6
varl2
Label
Length of information: Information stored:
1:2:-: Label:
varl3
Label
attribute:
VARIABLE 7"
Length of information: Information stored: vlt004:
Label:
vlt004
Label
attribute:
TEMPORARY 6
Length of information: Information stored:
1:2:/: Label
:
varl4
Label Length
attribute:
of
VARIABLE
information:
Information
4
stored:
1:-: Label
:
varl5
Label
attribute:
VARIABLE
Length of information: Information stored: fn*funcl:~: Label
:
11
varl6
Label attribute: VARIABLE Length of information: 7 Information
stored:
vlt006:
Label:
vlt005
Label Length
attribute:
of
TEMPORARY
information:
8
154
Information
stored:
l:-:2:/: Label:
vlt006
Label
TEMPORARY information: 11
attribute:
Length
of
Information
stored:
vlt005:3:*:
Label:
varl7
Label attribute: VARIABLE Length of information: 25 Information stored: Vlt007:vlt008:+: vltOlO
Label:
:+:
vlt007
Label
attribute:
Length
of
TEMPORARY
information:
6
Information stored: 2:3:/: Label:
vlt008
Label
TEMPORARY information: 6 Information stored: 4:5:/: attribute:
Length
Label:
of
vlt009
Label attribute: TEMPORARY Length of information: 6 Information stored: 5:6:*:
Label:
vltOlO
Label
attribute: TEMPORARY Length of information: 11 Information stored: vlt009:3:*:
Label
:
varl8
Label
attribute: VARIABLE Length of information: 13 Information stored: vlt011:4:-:+:
Label:
vltOll
Label attribute: TEMPORARY Length of information: 6 Information stored: 2:3:/:
Label
:
varl9
Label attribute: VARIABLE Length of information: 18
Information
stored:
vlt012:v*var7:-:+:
Label:
vlt012
Label '
Label
attribute:
TEMPORARY
Length of information: Information stored: 2:v*var6:/: :
11
var20
Label attribute: VARIABLE Length of Information: 14 Information stored: l:v*varl3:-:-:
Label
:
var21
Label
Label
:
attribute:
VARIABLE
attribute:
VARIABLE 7
var22
Label Length
of
information:
Information
stored:
155
vlt013:
Label:
vlt013
Label
attribute:
TEMPORARY
Information: Information stored:
Length
of
8
1:2:-:/: Label
var23
:
Label
Label:
attribute:
VARIABLE
attribute:
TEMPORARY
vlt014
Label
Length of information: Information stored:
2
1: Label
var24
:
Label Label:
attribute:
VARIABLE
vlt015
Label attribute: TEMPORARY Length of information: 3
Information 34: Label
stored:
var25
:
Label
attribute:
VARIABLE 7
Length of information: Information stored: vlt017:
Label:
vlt016
Label
attribute:
Length'
TEMPORARY
information: Information stored: 8:v*var5: *:
Label:
of
11
vlt017
Label attribute: TEMPORARY Length of information: 17
Information
stored:
vlt016:v*var22:/:
Label
:
var26
Label attribute: VARIABLE Length of information: 10 Information stored: v*varl4:~:
Label
:
var27
Label Label
:
:
VARIABLE
attribute:
VARIABLE
attribute:
VARIABLE
var27a
Label
Label
attribute:
var28
Label Length
of
information:
Information
7
stored:
vlt018:
Label:
vlt018
Label
attribute:
TEMPORARY 6
Length of information: Information stored:
1:2:/: Label
:
var29
Label
attribute:
VARIABLE
Length of information: Information stored:
22
l:2:+:3:+:4:+:5:+:6:+:
Label
:
var30
Label
attribute:
VARIABLE
156
Length of Information: Information stored:
7
vlt021:
Label:
vlt019
attribute: TEMPORARY Length of information: 8 Information stored: 65:59:*:
Label
Label:
vlt020
Label
attribute: TEMPORARY Length of information: 12 Information stored:
vlt019:45:/:
Label:
vlt021
Label attribute: TEMPORARY Length of information: 12
Information
stored:
vlt020:64:/:
15 7
START
card
information
Pseudo Code Generated
Total number of errors = 22 Simulation phase will not occur due * GPSS exiting
to
ERRORS
158
7.3.3. Simulator
Test Case 1 expon
and
Statistical
Results.
No discrepancies.
:
function
r,d3
.01,1/.05,2/.09,3
generate
fn "expon
terminate
1
start
1 R.I.T.
GPSS
compiler
absolute clock
block 1 2
Test Case 2: expon
=
3 total
current
0 0
Thesis GPSS
compiler
absolute clock
=
block
1 1
3
current
total
0 0
1
2
1 1
No discrepancies.
function
r,d3
.01,1/.05,2/.09,3
generate
fn "expon
terminate
1
start
20 R.I.T. GPSS
compiler
absolute clock
block
60
2
Test Case 3:
Absolute
20 20
function
clock
compiler
absolute clock
=
block 1 2
total
0 0
1
expon
=
current
Thesis GPSS
discrepancy
attributed
to
60
current
0 0
total
20 20
random number generation.
r,d3
.01,1/.05,2/.09,3
generate
fn "expon
terminate
1
start
100 R.I.T. GPSS
compiler
absolute clocks
block 1
2
300
current
0 0
Thesis GPSS
compiler
absolute clock
=
100
block 1
100
2
total
159
296
current
0 0
total 100 100
Test Case 4: expon
No discrepancy.
function
r,d3
.01,1/.05,2/.09,3
generate
fn "expon, 2
terminate
1
1
start
R.I.T. GPSS
absolute clock
block
=
Test Case 5:
Absolute
function
block
total
0 0
2
clock
GPSS
compiler
absolute clock
1
current
1
expon
Thesis
compiler
1
1
1
2
discrepancy
attributed
to
=
1
current
total
1
0 0
1
random number generation.
r,d3
.01,1/.05,2/.09,3
generate
fn "expon, 2
terminate
1
start
20 R.I.T.
GPSS
absolute clock
block 1
=
2
Test Case 6: Absolute
clock
function
53
current
0 0
expon
Thesis
compiler
GPSS
compiler
absolute clock
block 1 2
total
20 20
discrepancy
=
56
current
0 0
total
20 20
attributed to random number generation.
r,d3
,01,1/.05,2/.09,3
generate
fn*expon,2
terminate
1
start
100 R.I.T. GPSS
compiler
absolute clock
block 1
2
=
315
current
0 0
total
Thesis GPSS
compiler
absolute clock
=
block 1
100 100
2
160
296
current
0 0
total
100 100
Absolute
Test Case 7:
expon
function
clock
discrepancy
attributed to random number generation.
r,d3
.01,1/.05,2/.09,3
function
plus
r,d4
.25,1/.50,2/.75,3/.9999,4
generate
fn*expon,fn"plus
terminate
1
start
1
R.I.T. GPSS
absolute clock
block
Thesis
compiler
=
12
0 0
2
compiler
absolute clock
total 1 1
current
1
GPSS
block 1
2
=
3
current
total
1
0 0
1
Test Case 8:
There is a large discrepancy seen in the absolute clock time. My is the R.I.T. GPSS simulator is in error when it evaluates the functions. The functions have been created so the function expon has a value of 3 90% of the time and the Thus: function plus has a value which is evenly distributed in the range 7 to 4.
conclusion
expon
3 avg. 2.5 avg. = 3*2.5
-
plus
=
generate generate
expon
*
function
time
=
7.5 7.5'
units
=
20
=
150
avg.
r,d3
.01,1/.05,2/.09,3
plus
function
r,d4
.25,1/.50,2/.75,3/.9999,4
generate
fn "expon, fn "plus
terminate
1
start
20 R.I.T.
GPSS
absolute clock
block
1
2
Thesis
compiler
=
0 0
compiler
absolute clock
240
current
GPSS
total
block
20 20
1
2
161
=
150
current
0 0
total
20 20
clock time. My There is a large discrepancy seen in the absolute Test Case 9: functions. evaluates the The when it error conclusion is the R.I.T. GPSS simulator is in of 3 90% of the time and the functions have been created so the function expon has a value 1 to 4. Thus: range the in distributed which is function plus has a value evenly
expon
3 avg. 2.5 avg. 3*2.5
=
plus
=
generate generate
expon
=
=
*
function
7.5 7.5'
time units
=
750
100
avg.
r,d3
.01,1/.05,2/.09,3
function
plus
r,d4
.25,1/.50,2/.75,3/.9999,4
generate
fn*expon,fn"plus
terminate
1
100
start
R.I.T. GPSS
absolute clock
block
=
0 0
2
The discrepancy
Test Case 10:
total
block
100
1
100
2
seen
in both the
are attributed to the difference in evaluation Case's 8 and 9 for an in-depth explanation.
expon
function
GPSS
compiler
absolute clock
1200
current
1
Thesis
compiler
of
absolute clock
=
726 total
current
100
0 0
100
time and the block totals
the plus function.
Please
refer
to
r,d3
.01,1/.05,2/.09,3
plus
function
r,d4
.25,1/.50,2/.75,3/.9999,4
generate
fn "expon
terminate
1
generate
fn*plus
terminate start
100 R.I.T. GPSS
compiler
absolute clock
block 1
1
2 3
0 0 0
4
=
172
current
Thesis GPSS
compiler
absolute clock
=
total
block
58 57 43 43
1
2
3 4
162
132
current
0 0 0 0
total 44 44
56 56
Test
No discrepancies.
Test Case 11:
100/50*3 + 2
variable
van
generate
v"van
terminate
1
start
1 R.I.T.
GPSS
compiler
absolute clock
block
0 0
2
Test Case 12:
100/50*3
variable
v*var1
terminate
1
compiler
absolute clock
total 1 1
block
=
8
current
1
total
0 0
2
1 1
+
2
20 R.I.T. GPSS
block 1
=
160
current
0 0
2
No discrepancies.
van
100/50*3 + 2
variable
v*var1
terminate
1
GPSS
compiler
absolute clock
block 1 2
total
20 20
Test Case 13:
generate
Thesis
compiler
absolute clock
start
GPSS
No discrepancies.
generate
start
8
current
1
van
=
Thesis
=
160
current
total
0 0
20 20
100 R.I.T. GPSS
absolute clocks
block
1 2
Thesis
compiler
800
current
0 0
GPSS
compiler
absolute clock
block 1 2
total
100 100
163
=
800
current
0 0
total
100 100
There is a large discrepancy in both the absolute clock time and the total An analysis of the generate blocks shows two transactions being contents of the blocks. created every five time units. Therefore, the run termination count will be reached after 250 times units + advance block time. Again, the conclusion is the R.I.T. GPSS simulator is in
Test Case 1 4:
error.
generate
5
assign
1,
advance
P*1
terminate
1
generate
5
assign
1.
advance
P*1
terminate
1
start
+
+
5
2
100
GPSS
R.I.T.
absolute clock
47
compiler
absolute clock
=
255 total
block
1
10
1
1
51
2 3
0
2
4
0
0 0 0
5 6 7 8
1
9 9 8 10 9 9 9
1
50 50 50 51
0 0 0
50 50 50
current
1
0 0 0
Test Case 1 5: the
checking the generate assign
The
current
simulators
of
block
adding
7 the
current
3 4
5 6 7
8
discrepancy is due transaction
to
the
to
the
current
different events
philosophies chain
before
absolute clock time.
5 1,-2
assign
1,
advance
p"1
terminate
1
start
=
GPSS
total
block 1
between
Thesis
compiler
+
5
100 R.I.T. GPSS absolute
block 1 2
3 4
5
Thesis GPSS
compiler
clock=
503
absolute clock
total
block
1
101
1
0 0 0 0
100 100 100 100
2
current
compiler
3 4
5
164
current
0 0 0 0 0
=
503 total
100 100 100 100 100
The current block 1 Test Case 16: between the simulators of adding the checking the absolute van
variable
var2
variable
v*var1
advance
v*var2
terminate
1
GPSS
the
current
events
philosophies chain
before
time.
compiler
absolute clock
block 1
1
2
2 0
Test Case 17: simulators
of
.
advance
transfer generate
terminate start
to
exit
discrepancy
other
1,
=
block 1
205 total
current
0 2 0
2 3
is due to the different
102 102
100
philosophies
between the
before
checking the discrepancies in block counts are due to the philosophy to
the
current
events
chain
+
5
,label1
100 1
1
block
compiler
=
100
current
1
1
2
0 19 0 0 0
79 79 60 1
Thesis GPSS
compiler
absolute clock
=
block 1
total
20
5 6
absolute clock
the model.
absolute clock
4
compiler
p*l
R.I.T. GPSS
3
Thesis GPSS
5
generate assign
total
transaction
the
All
time.
on when
205 103 102 100
77?e block
adding
clock
difference
=
current
3
labell
is due to the different to
100 R.I.T.
absolute
transaction
2 2+3
generate
start
clock
discrepancy
2
3 4
5 6
1
165
100
current
0 0 20 0 0 0
total
20 85 85 65 1 1
Test Case 18: Both the block and the storage statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time. var2
variable
1
storage
2+3 100
generate
2
assign
1
enter
+ 1 1,v*var2
advance
3
leave
1
terminate
1
start
,
,5
100
R.I.T.
GPSS
absolute clock
block
Thesis
compiler
=
203
current
compiler
absolute clock
total
block 1
1
102
2
0 0
101
2
101
3
1
101
4
1
0 0
100 100
5 6
0 0
4
5 6
.
Storage
Capacity Average Contents
1 1
100 100
7.414
7.389
Average Total Average Util Entries T/Trans 0.074 505 2.98 0.074 2.97 505
166
=
203
current
1
3
R.I.T. : Thesis :
GPSS
0 0 0
total 101 101 101 101 100
100
Maximum Current Contents Contents 10 5 10 5
Both the block and the queue statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time.
Test Case 1 9:
varl
2
var iable
generate
2
assign
1.+ 1
+
3
queue
1,v*var2
advance
5
depart
1,v*var2 1
terminate start
100 R.I.T. GPSS
compiler
absolute clock
block 1 2
3 4
5 6
,
Queue
R.I.T. : Thesis :
1 1
=
205
current
1
0 0 2 0 0
Thesis GPSS
compiler
absolute clock
=
total
block
103 102
1
2
102
3
102
4
100 100
5 6
Total Contents Contents Entries 510 12.293 15 510 12.195 15 Maximum Average
167
Zero Entries
0 0
205 total
current
0 0 0
102 102
2 0 0
102
Average T/Trans 4.941 4.902
102
100 100
Current Contents 10 10
Test Case 20: Both the block and the facility statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time and when is the correct time to exit the model.
generate
2
assign
1.
seize
1
advance
20
release
1
terminate
1
+
1
20
start
R.I.T. GPSS
ab solute clock
block 1
2 3 5 6 Fa cility R.I.T.
Thesis
: :
=
402
current
201
180
200 20 20 20 20
Average Utilization
1
.995
1
.910
GPSS
compiler
absolute ClO(:k=
block 1
total
1
0 0 0 0
4
Thesis
compiler
2 3 4
5 6
Number
Entries 20 20
168
Average T/Trans 20.000 20.000
Seizir>g
Contents .
3
440
current
0 200 0 0 0 0
total
220 220 20 20 20 20
Test Case 2 1 simulators
:
of
discrepancy is due
transaction
the
to
to the different
the current
events
generate
between the
checking
1
1.
test g terminate
p*1, 21
start
20
+
.label
10
R.I.T. GPSS
compiler
absolute clock
block 1
2
3 4
block
=
20
Thesis GPSS
compile,r
absolute clock
=
total
block
1
11
1
1
11
0 0 2
220 220 10
2
0 0 2
220 220 10
=
3 4
40
current
current
absolute clock
total
block
1
1
21
1
2
0 0 2
440 440 20
2 3
.
22
total
current
absolute clock
4
before
2
assign
3
philosophies
chain
time.
absolute clock
label
The block
adding
4
169
=
40
current
0 0 0 2
total
20 440 440
20
the
Both the block and the facility statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time and when is the correct time to exit the
Test Case 22:
model.
generate
label
2
assign
1.+ 1
advance
4
seize
1
gate u
1, label
advance
10
release
1
terminate generate
4
terminate
1
start
20 R.I.T. GPSS
absolute clock=
block 1
2 3
.
4
5 6 7
block
1
40
0 31 0 0
39 39 8 8 8
1 2
Average Utilization
1
.925
1
.750
compiler
absolute clocks
total
0 0 0 0
Facility R.I.T. : Thesis
80
current
1
8 9 10
Thesis GPSS
compiler
3 4
5 6 7
7 7
Number Entries 8 7
170
Average T/Trans 9.250 8.571
Seizin'9
Contents 9 4
total
0 0 33 0 0
40 40
1
7 6 6 20 20
0 0 0 0
8 9 10
20 20
80
current
40 7 7
Test Case 23: different chain
Both the block and the (ability statistic discrepancies are due to the between the simulators of adding the transaction to the current events
philosophies
before checking the absolute
clock
time and
is the correct time to
when
exit
model.
assign
2 1,41
generate
label
advance
4
gate nu
1, label
seize
1
advance
10
release
1
terminate
1
20
start
R.I.T. GPSS compiler absoliute clock=
block 1
1
2
0 82 0 0 0 0 0
103 2122 2122 2040 20 20 20 20
5 6 7 8
Facility
Thesis
1 :
1
block 1 2
5 6 7 8
Number
Entries 20 20
.820
171
Average T/Trans 10.000 10.000
Seizing Contents -
5
244
current
4
Utilization
compiler
clocks
3
Average
.971
GPSS
absolute
total
4
:
206
current
3
R.I.T.
Thesis
0 0 62 0 0 0 0 0
total
122 2122 2122 2060 20 20 20 20
the
Test Case 24:
Botfi
the block and the storage statistic discrepancies are
due to the
different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time and when is the correct time to exit the model.
1
label i\
storage
100
generate
2 1
assign
1.
advance
4
gate se
s*1, label
enter
s*1
+
advance
10
leave terminate
s*1
start
1
20 R.I.T. GPSS absolute
block 1 2
clocks
206 total
1
103 2122 2122 2040 20 20 20 20
0 82
4
0 0 0 0 0
5 6 7
8
Capacity Average Contents
R.I.T. : Thesis :
1 1
100 100
GPSS
compiler
absolute clocks
current
3
Storage
Thesis
compiler
.971
.820
block 1
2 3 4
5 6 7 8
Average Total Average Util Entries T/Trans 0.010 20 10.000 0.008 20 10.000
172
244
current
0 0 62 0 0 0 0 0
total 122
2122 2122 2060 20 20 20 20
Maximum Current Contents Contents 1 0 1
0
Both the block and the storage statistic discrepancies are due to the between the simulators of adding the transaction to the current events
Test Case 25: different chain
1
label il
philosophies
before checking the absolute clock time. storage
100
generate
2 1
assign
1,
advance
4
enter
s*1
gate sf advance
s*i, label 10
leave
S*1
terminate
1
start
+
20
R.I.T. GPSS absolute
block 1
clocks
R.I.T. : Thesis
121
0
219 219 119 119 20 20 20
100
4
0 0 0 0 0
.
1 1
Capacity 100
100
GPSS
compiler
absolute clocks
block 1
total
1
3
Storage
242
current
2
5 6 7 8
Thesis
compiler
2
0 0
3
124
4
0 0 0 0 0
5 6 7 8
Average Average Total Average Util Entries T/Trans Contents 178.403 119 87.727 0.877 174.429 119 86.923 0.825
173
288
current
total 144
243 243 119 119 20 20 20
Maximum Current Contents Contents 100 99 100 99
Test Case 26:
Both the block and the storage statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain before checking the absolute clock time and when is the correct time to exit the model.
1
label il
storage
100
generate
2 1
assign
1,
advance
4
gate snf
s*1, label
enter
s*1,100
+
advance
10
leave
s*1,100
terminate
1
start
20
R.I.T. GPSS
absolute clocks
block 1 2
3
206 total
1
103 2122 2122
0 82 0 0 0 0 0
.
5 6 7 8
Capacity
block 1
2
3
2040 20 20 20 20
4
5 6 7 8
1 1
100 100
compiler
244
current
0 0 62 0 0 0 0 0
total
122 2122 2122 2060 20 20 20 20
Average Average Total Average Maximum Current Util Entries T/Trans Contents Contents 97.087 2000 10.000 100 0 81.967 2000 10.000 100 0
Contents R.I.T. : Thesis :
GPSS
absolute clocks
current
4
Storage
Thesis
compiler
.971
.820
174
Test Case 27:
Both the block and the storage statistic discrepancies are due to the different philosophies between the simulators of adding the transaction to the current events chain
before checking the
absolute
clock
time and
when
is the
correct
time to exit the
model.
1
labelH
storage
100
generate
2
assign
1.+ 1
advance
4
enter
S*1
gate sne
advance
s*1, label 10
leave
S*1
terminate
1
start
20
R.I.T. GPSS
absolute clocks
block 1
54
current
1
0 2 0 0
2 3 4
5 6 7 8
Thesis GPSS
compiler
,
4
0 0
compiler
absolute clock
block 1
total
27 26 26 24 24 24 20 20
2
1
1
100 100
4.074
3.703
4
5 6 7
8
.041
.037
175
24 25
54
0 0 2 0 0 5 0 0
3
Storage Capacity Average Average Total Average Entries T/Trans Util Contents R.I.T. : Thesis
s
current
9.167 8.000
total
27 27 27
25 25 25 20 20
Maximum Current Contents Contents 4 5 5 6
Final
Test Case:
GPSS VI. 0 May. 1984 J. Van Dellon -
author:
l 2
i
Purpose:
3
The following program 1s used for a generic debugging tool for the GPSS compiler/simulator thesis. The following program depicts a traffic problem over a bridge where one lane has been shut off and the traffic is redirected through the other lane by means of a traffic light at each end of the bridge.
4
5 6 7 8 9 10 11 12 13 14 15 16
Written:
Jacky
Parameters
Van Dellon
March
15.
1984
:
4
keep keep
5
count
of
cars
count
of
cars
in direction 2 in direction 1
17
18
simulate
19
20 21 22 23 24 25 27 28 29 30 31 32 33
Traffic expon
lights
function
problem
r,d23
0.0.0/0.1.10/0.2.22/0.3,35/0.4.50/0.5.69/0.6.91/0.7,120/0.8.160/0.84.183/ 0.88,212/0.9,230/0.92,252/0.94,281/0.95,299/0.96.320/0.97,350/0.98,390/ 0.99,460/0.995,530/0.998,620/0.999,700/0.9997,800 grel
variable
gre2
variable
stop 1 2
storage
600 450 1 30 30
storage storage
from direction
traffic
I I
length length
I I I
storage
to
storage
used
storage
used
of
time
of
time
for for
green green
flow
restrict
for entering for entering
light light of
in
direction in direction
transactions
cars
in
direction
cars
in
direction
1
34
35 36
seize
38 39 40 41 42 43
gate
45 46 47 48 49 50
51 52 53 54
55 56 57
Igenerate cars lenter queue Iseize starting lis light green Inull transfer
1
queue
37
44
90, fn^expon
generate
1 1
u
transfer
.delay
place
i
7 8 9 10 11 12 13
nulll
advance
100
Inull
delay
advance
20 5.+1
Istart car ! keep count of cars lenter storage Heave queue (release starting place Heave storage Icar is over bridge
assign enter
depart release
leave
1,1 1 1 1
terminate traffic
14
generate
queue
18
test g
p5.
seize gate
u
block
from direction 2
15 16 17
120
,
f n"expon
Igenerate cars
2 2 2
lenter
queue
Iseize starting position lis light 2 green Icheck for ten cars in the
10, around
counter
58
59 60 61
62 63 64
65 66 67
19
null2
advance
100
Inull
20
around
advance
20 4.+1 2 2
Istart car Icount cars in direction 2 Heave starting place I release starting place Icar is over bridge
21 22 23 24
assign
depart release
terminate traffic
block
lights
68
69 70 71 72 73 74
25 26 27 28
29
generate
gate
loop
se
1 s-stop,ter
enter
sstop
advance
550 1
seize
176
ljust start this sequence up Imake sure only one goes through lone 1s through and starts cycle Iboth lights
red
Might 1 becomes
green
1 2 1 2
75 76 77
78 79 80 81 82 83
30 31 32 33 34
35 36 37
seize
1 550 2
advance
v*gre2
release
2
transfer terminate
term
Igreen time for 1 ! light one turns red
Iboth lights red Might 2 becomes green Igreen time for 2 Might two turns red (begin new light cycle
.loop
i
auxiliary
85 87
v*grel
release advance
84 86
advance
38 39
clock
36000 terminate 1 generate
88 89
lone transaction {decrement
start
90 91 92 93
start
end
1/ L/
/
per
hour
Absolute
36000
clock:
BLOCK COUNTS Current Total Block ==3ZC = =
=
0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 BLOCK
Block
==
=
~
=
35 36 37
38 39 Facil iity
stop 1
0
16
0 0 0 0 0 0
5 5 5 5
17
0
18 19 20
0
0 0
5 5 5 2 2 2 2 2 0 2
Block
Current
Total
= == ==
_._
= = = ==
11 12 13 14
15
Average
Number
Utilization
Entries 22 18
0.286111 0.201111
1 2
Storage
= = = = S
5 5 5 5
'
1
Block
= = =
Current Total
2 0 2 0 2 0 2 0 0 36000 1 36000 1 0 17 0 17 0 17 0
21 22
23 24 25
26 27 28 29 30
Bl
ock
= =
B=S===
Current Total
17 17 16 16 16 16 d 35998 0 1 0 1
32 33 34
2
Total
KE = E = = X
0 1 0 0 0 0
31
Queue
Current
SaSSS
5
COUNTS Cu rrent Total _
Block
Maximum
Contents 2 1
Capacity 1 30
Average Contents 0.074472 0.000005 Average Contents 0.000000 0.000000
Total Entries 2 5
Average Time/Tran
Seizing Trans
402.22222
Average Zero Entries Time/Trans 0 1340.500000 0.037830 0
Average Entries Utilization 0.000000 1 0.000000 5
.No.
3 33
468.18182
Current Contents 0 0
Average
Current
Time/Trans Contents 1 0.000000 0 0.000000
178
Maximum
Contents 1 1
R.I.T.GPSS
compiler
absolute clocks
block
current
36000 total
1 0 0 0 0 0 0 0 0 0
1 2
3 4 5 6 7
8 9 10
1
0 0 0 0 0 0 0 0 0
block current 31 0 32 1
33
0 0 0 0 0 0 0
34 35 36 37
38 39
R.I.T.
17
18 19 20
1
1
0 0 0 0 0 0
0 0 0 0 0 0
block
current
21 22 23 24 25 26 27
28 29 30
0 0 0 0
total
0 0 0 0
1
36000 35999
0 0 0 0 0
1
17 17 17
17
16 16 16 16
'
35998 1 1
Capacity 30
1
Average Average Total Average Contents Util Entries T/Trans 0 0.000 0 0.000 1.000 1 1.000 35999.0
Stop
1
Facility
Average Utilization
1
2
NO
14 15 16
tc total 0 0 0
total 17
Storage R.I.T.
block current 11 0 12 0 13 0
QUEUE
Number Entries
.283
.200
STATISTICS
WERE
17
Average T/Trans 600.000
16
450.000
GENERATED.
179
Seizing Contents
Maximum Current Contents Contents 0
0
1
1
180
8.
Conclusions.
8.1.
Problems
Encountered
The GPSS
programmer
program
to the other,
TRANSFER
Solved.
and
had no easy way to transfer control from one part of the the original thesis proposal GPSS subset. Therefore, the added to the initial subset of 18 block statements.
given
statement
was
After the design phase of the pseudo language was complete, the decision was made to generate the pseudo code in the first pass to increase the efficiency of the compiler.
Instead
the first pass strictly
of
being parsing
and
the second pass strictly
being
code
generation, the design was changed to parse and create the skeleton of the pseudo code in
the first pass.
The
the
was
generator
second pass would complete the pseudo code structure. a
simple
Discrepancies
8.2.
The
language, GPSS
main
and
and
the
and
The VAX/VMS C of
the
period
greater
design
of
the
Integration of parser.
the System.
the GPSS compiler/simulator is the entire set of the GPSS implemented. This subset effects both the style of the ability to accurately represent all models. of
number
random
with
vary significantly,
than
a
single
utility
,
implemented in
separate generators
results would not
of
modular
options are not
programmer
capability
Shortcomings
shortcoming
its
due to the
addition
other
a
valid
GPSS
generator,
compilers.
the multiple generators, but they number
random
although
The
lacks the statistical
would give you
a
utility.
Due to the subset of the language implemented for this thesis, only the Current Events Chain and the Future Events Chain are used. The two chains not implemented are the Interrupt Chain and the User Chain.
The the
statistical output cannot
standard
informational
The GPSS compiler also for the user would be
addition
8.3.
Lessons
be formatted by the
user
thus constraining the
user
to
output.
no interrupts during the interactive debugging tool.
allows an
simulation.
A
useful
Learned.
The thesis was designed to enhance my knowledge of code generation and symbol design. This particular goal was achieved but several added benefits were received table 1. The ability to research a subject and put these abstract concepts through this project: into workable programs, and 2. The knowledge that hours spent in program design are not wasted. The time spent planning will save many hours of redesign on the fly, therefore making the
8.3.1.
program
into
Alternative Although the
a
kludge.
Approaches
symbol
table's
for
binary
Improved
tree
structure was sufficient
GPSS language defined by this thesis, the improved be a necessity for any future expansion of this
181
System.
performance of a compiler.
for the subset hash algorithm
of
the
would
The pseudo code generator was implemented because implement a form of code generation. It would be implement the GPSS language as an interpreter.
and
8.3.2.
Suggestions for
Many different The
this thesis. current
would
An admirable
A
required would
Related
make
the subset this
to the
my desire to learn, design interesting alternative to i
Extensions.
GPSS language
and powers of the of
addition
statistical
complicated,
8.3.3.
aspects
expansion
statements
format the
Future
of
an
of
a
compiler
statistical
viable
were not
implemented in of options to
the addition tool for everyday
statements
and
output would
use.
be the ability for the
user
to
results.
to the GPSS be the implementation of
enhancement
Thesis
Topics
for the
as the language interactive debugger.
compiler, an
grows
more
Future.
Although many of my graduate classes touched on the subject of hash algorithms, the task of researching various methods and implementing a hash algorithm would not be a trivial task. The performance of the hash algorithm could even be measured against a binary tree structure, such as implemented in this thesis. Therefore, a conclusion could be drawn as to whether, a hash implementation is justified for this specific case, the GPSS language. implementation really is for optimization purposes. There is a realm implementation of an optimizer. Also, optimization of code is an area which computer classes touch lightly, and a thesis in this area would be a good way to accomplish a stronger, well rounded background. A pseudo. for
of possibilities
Along
code
research papers and an
with optimization of
An interactive debugger, research
code, an area
seldom
although not a project within
project.
182
delved into is the art of debugging. could be an integral part of a
itself,
9.
Bibliography.
Aho, Alfred V.
Ullmann, Jeffrey D.,
and
Publishing Company,
Principles
of
Compiler Design,
Addison-Wesley
1977
Barret, William A. and Couch, John D., Compiler Construction: Theory Science Research Associates, Inc., 1979
Bassett, Sam, Computer Design: "Multipass
and
Practice,
compilers produce tight code", page
44-47,
1984
Brown, P. J., Writing Interactive Compilers
and
Interpreters,
John
Wiley
and
Sons, 1979
Cocke, John and Schwartz, J.T., Programming Languages and Their Compilers: Preliminary Notes, Second Revised Version, Curant Institute of Mathematical Sciences, New York University, 1970 Goos, G.,
and
Construction 1976
-
Gordon, G., Number
1,
J. Hartmanis editted by, Lecture Notes in Computer Science: Compiler An Advanced Course, Second Edition, Springer-Verlag Berlin- Heidelburg,
"A
General Purpose Systems
Simulator",
IBM Systems Journal, Volume 1,
1962
Gordon, G.
and
Efron, R.,
Application: Part I, Description 1964
Gould, R.L.,
"A of
General Purpose Digital Simulator and Examples of Its Simulator", IBM Systems Journal, Volume 3, Number 1
the
,
An Improved General Purpose Simulator", IBM Systems Journal, "GPSS/360 1969 -
Volume 8, Number 1,
Herscovitch, Simulator",
H.,
and
Schneider,
IBM Systems Journal,
Hetzel, William C,
Program
M.
David,
An Expanded "GPSS III Number 3, 1965
Testing Methods, Prentice Hall, Inc.,
Lewis, T.G., Distribution Sampling Company, 1975 Martin,
T.,
General
Purpose
Volume 4,
for Computer Simulation,
Lexington
1972
Books, D.C. Heath
General Purpose Simulation System for VAX/VMS Reference Manual, and Development, Ontario, Canada, 1981
Simulation Software Design
Pratt, Terrance W., Programming Inc., 1975 Programming XEROX
in
General
VAX-11 Purpose
Languages: Design
and
Implementation, Prentice Hall,
C, Digital Equipment Corporation, 1982, Page 140 Discrete Simulator
183
(GPDS), Reference Manual,
1972
184
10.
Footnotes. 1. Compiler Construction: Theory and Practice, page 466, William A. Barrett John D. Couch, Science Research Associates, 1979. 2.
A General Purpose Systems
and
Simulator,
page
18, Geoffrey Gordon, IBM Systems
Simulator,
page
20, Geoffrey Gordon, IBM Systems
Journal, September 1962. 3.
A General Purpose Systems
Journal, September 1962. 4.
Simulation
GPSS
with
Probst, Prentice-Hall,
and
GPSS V,
page
1, P.A. Bobillier, B.C. Kahan, A.R.
Inc., 1976.
5. A General Purpose Digital Simulator and Examples of its Application: Part I Description of a simulator, page 22-23, R.EFRON and G. Gordon, IBM Systems Journal, Volume 3, 1964 -
6.
Writing Interactive Compilers and Sons, 1979
and
Interpreters,
page
66, P.J. Brown,
John
Wiley,
Principles of Compiler Design, page 327-349, Alfred V. Aho & Jeffrey D. Ullman, Addison-Wesley Publishing Company, 1977
7.
8.
Simulation
GPSS
with
9.
GPSS/360
-
an
and
GPSS V,
page
2, P.A. Bobillier, B.C. Kahan, A.R.
Inc., 1976.
Probst, Prentice-Hall,
improved general purpose simulator, Number 1, 1969.
page
18, R.L. Gould, IBM
Systems Journal, Volume 8, 10. Simulation
with
GPSS
Probst, Prentice-Hall, Inc., 11. XEROX
General
Corporation,
1972.
and
2, P.A. Bobillier, B.C. Kahan, A.R.
GPSS V,
page
Discrete
Simulator
1976.
Purpose
185
(GPDS),
page
36,
XEROX
186
11.
Appendices.
11.1.
Appendix A
BNF
grammar of
the GPSS language.
block= block-number if(((word=
/
ERROR)
==
getword())
for
check
/
create
/
get
/
if
label
valid
pseudo
code
/
for block */
1;
EOL) );
||
(word
==
COMMA))
A-operand /
return(error(REQ-OPER)
if (isdigit(*word)) if (prsnum(word, root)
==
numeric
check
for validity /
ERROR)
return(error(NO-OPER));
if(((ret-status=
else
&
(ret-status
==
prsolb(word
.
root))
==
ERROR)
SNA-RANDOM))
&& (ret-status / if
==
LAB-STOR)
alpha
check
for
SNA
/
return(error(NO-OPER)) ; ps-cur->A-operand=
cur-label=
if((word=
cur-label ;
hold-label; getword())
!=
/
EOL)
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
ink;
return(SUCCESS);
}
237
make
sure
thats
all
on
the
line */
/+
NAME: *
prsass
* **
SYNOPSIS:
**
int prsass(root) SYM-TABLE
**
root;
** **
PURPOSE:
**
Parse
for ASSIGN instruction.
operands
** **
RETURNS:
**
ERROR
-
found
error
any
parsing the ASSIGN
when
* **
statement
MAINTENANCE:
*
15-June-83
**
18-Mar-84
jvd jvd
created added
pseudo
code
generation
**
-*/
#include ^include ^include
stdio
global ref
char
global ref
global ref
int end-line-pointer; SYM-TABLE cur-label ; CODE *ps-cur;
global ref
char
temp-label[]
global ref
int
block-number;
ctype
"[vandel Ion.
global ref
thesis]gpss"
line[];
;
int prsass(root) SYM-TABLE *root;
{ char
word;
SYM-TABLE SYM-TABLE SYM-TABLE int int
hold-label; hold-A; *hold-B;
/*
/*
/*
hold cur-label hold A-oper if hold B-oper if
*/
address
2
pseudo
code
statements
needed
2
pseudo
code
statements
needed
*/ */
ret-status; /*
1;
work-var=
if(prslab(hold-label)
used
if
negative
encountered
/
ERROR)
==
sign
check
for
*/
label
correct
/
return(ERROR) ; /
crepsd(ASSIGN); ps-cur->block=
block-number
if(((word=
1; (word
||
getword()) EOL) return(error(REQ-OPER)) ; ==
COMMA))
==
if (isdigit(*word))
create
pseudo
/
assign
correct
/
get
/
A-operand
A-operand
a
for block / block id /
code
/
numeric
check
for
validi
/
>ty
ERROR)
==
if(prsnum(word,root)
return(ERROR); cur-label
->attr-pnt->lab-attribute=
SNA-PARAM;
} else
if(((ret-status=
||
(ret-status
prsolb(word
,
root))
==
ERROR)
||
SNA-RANDOM))
==
(ret-status == LAB-STOR) / A-operand alpha
check
valid
SNA /
return(error(NO-OPER)) ; ps-cur->A-operand=
cur-label=
if((word=
/
cur-label;
/
hold-label; getword())
!=
/
COMMA)
assign
get
A-operand
correct
check
*/
current
label
back
/
for COMMA /
return(error(REQ-OPER)); if(((word=
getword())
==
EOL)
||
(word
/
COMMA)
get
B-operand /
return(error(SYNTAX));
if ((1 ine[end-l '
ine-pointer]
==
'
+
') || (1
ine[end-l
ine-pointer]
==
'-'))/
check
for correct
/
if (1 ine[end-l
ine-pointer]
work-var=
==
/
'-')
/
end-line-pointer++; if(((word=
subtraction
-1;
getword())
==
EOL) ||
(word
==
238
COMMA))
/
go get
to
next
rest
o
arithmetic
/
operator
return(error(SYNTAX)); else
1f (1sdigit(*word))
/
numeric
/
change
/
get
for validity /
check
{ if (prsnum(word.root)
ERROR)
==
return(ERROR);
'
(cur-label->attr-pnt->pnt-1nfo) ps-cur->B-operand=
*=
work-var;
cur-label;
sign
in
B-oper
if
numeric
of
place
negative
/
} else
if(((ret-status=
&& (ret-status
prsolb(word !=
,
root))
!=
ERROR) &&
SNA-RANDOM))
!=
(ret-status
LAB-STOR)
/
alpha
check
/
has NO!
negative
for validity /
{ if(work-var >
0)
ps-cur->B-operand=
/
cur-label;
a
found
sign
been
code
statement
/
/
else
{ hold-A=
/*
ps-cur->A-operand ;
ps-cur->operator= ps-cur->A-operand=
temp-label[3]=
/
NEG;
/
cur-label;
A-oper */
store add
new
put
in A-oper /
pseudo
/
NULL;
if(strlab(root,strcat(temp-label
==
ERROR)/*
,itoa()),0)
create
value
label
value
/
assign
*/
new
return(error(COMPILER)); hold-B=
ps-cur->B-operand=
cur-label
cur-label;
->attr-pnt->lab-attribute=
cur-label ps-cur=
->attr-pnt->pnt-info=
ps-cur->code-l
malloc(sizeof
ink;
crepsd(ASSIGN); ps-cur->block=
block-number
ps-cur->A-operand= ps-cur->B-operand=
-
CONSTANT;
1 ;
cur-label->attr-pnt->leng-inf o=
(int))
/
new
/
create
/*
restore
;
pseudo
code
pseudo
negates
code
for
1;
hold-A; hold-B;
} } else
return(error(NO-OPER)) ; cur-label=
hold-label;
good
label
/
} if(getword()
!=
/
EOL)
make
sure
end
of
line
/
return(error(SYNTAX)) ; ps-cur=
ps-cur->code-l
/
ink;
239
get
to
new
pseudo
code
statement
/
/+
NAME: .*
prsblkl
..
SYNOPSIS: int prsblkl( root .command) SYM-TABLE "root
.. ..
int
command
.*
PURPOSE: .*
Parse
for DEPART.
operands
QUEUE.
ENTER,
and
LEAVE
instruction.
.*
RETURNS: **
ERROR SUCCESS
.. *
error
syntatic
-
detected
OK
-
MAINTENANCE:
*.
jvd jvd
15-June-83 18-Mar-84
*.
created generation
added
of
pseudo
code
.*
-/
^include #include
stdio ctype "[vandellon.thesis]gpss"
^include
line[];
global ref
char
global ref
global ref
SYM-TABLE cur-label; CODE ps-cur;
global ref
char
temp-label
global ref
int
block-number;
int
[];
prsblkl(root, command)
SYM-TABLE
*root;
int
command;
{ char
*word;
SYM-TABLE
hold-label=
int int
prsnum();
NULL;
ret-status; ==
if(prslab(hold-label)
ERROR)
/
check
/
fill
for
label
valid
/
return(ERROR);
crepsd( command) ; ps-cur->block=
if(((word=
block-number
==
getword())
in
code
pseudo
/
1;
-
EOL)
||
(word
==
COMMA))
/
get
/
check
A-operand
/
return(error(REQ-OPER));
if (isdigit('word))
if(prsnum(word, root)
for
valid
numeric
/
ERROR)
==
return(ERROR); ps-cur->A-operand=
if((command
else
==
if(((ret-status=
SNA
cur-label;
ENTER)
||
(command
prsolb(word,
==
root))
!=
LEAVE))
ERROR) && (ret-status
!=
SNA-RANDOM))/*
check
for
valid
/ ps-cur->A-operand=
cur-label
;
else
return(error(N0-OPER)) ;
if((command
else
==
if(((ret-status=
||
DEPART)
(command
prsolb(word,
root))
==
!=
QUEUE)) ERROR) && (ret-status
!=
LAB-STOR)/*
/
&& (ret-status
!=
ps-cur->A-operand=
SNA-RANDOM)) cur-label;
else return(error(NO-OPER));
cur-label=
if((word=
hold-label; getword())
==
/
EOL)
{ 240
no
B-opera
check
for
valid
SNA
tenp-label[3]=
NULL;
if(strlab(root,strcat(temp-label
==
,itoa()),0)
ERROR)
return(error(COMPILER)); ps-cur->B-operand=
cur-label;
cur-label
->attr-pnt->lab-attribute=
cur-label
->attr-pnt->leng-info=
cur-label
->attr-pnt->pnt-info=
malloc(sizeof
cur-label->attr-pnt->pnt-info= ps-cur=
ps-cur->code-l
CONSTANT;
0;
(int))
;
1 ;
ink;
return(SUCCESS); else}if(word
==
if(((word=
COMMA) EOL) ||
==
getword())
(word
==
if COMMA look for B-operand
/
else
/
check
/
COMMA))
return(error(SYNTAX));
} if(isdigitCword)) if(prsnum(word,root)
for
valid
/
numeric
ERROR)
==
return(ERROR);
else
if((ret-status=
||
prsolb(word.
(ret-status
==
root)
==
ERROR)
SNA-RANDOM))
||
(ret-status
==
LAB-STOR)
/
check
/"
">ake
/
get
for
valid
SNA /
return(error(NO-OPER)) ; ps-cur->B-operand=
cur-label=
if((word=
cur-label;
hold-label; getword())
!=
EOL)
sure
end
of
line
/
return(error(SYNTAX));
ps-cur=
ps-cur->code-link;
}
241
to
new
pseudo
code
statement
/
/+
NAME: *
prsblk2
SYNOPSIS: int
prsbl
**
k2( root command) ,
SYM-TABLE int
*
'root command
PURPOSE: *.
Parse
operands
for SEIZE
and
RELEASE
instruction.
..
RETURNS:
ERROR
-
syntatic
detected
error
**
MAINTENANCE: **
15-June-83
*.
18-Mar-84
jvd jvd
created added
generation
of
pseudo
code
-/
#incl
ude
stdio
^include ^include
ctype
"[vandel Ion. thesis
]gpss"
line[];
global ref
char
global ref
SYM-TABLE *cur-label ; CODE *ps-cur; int block-number;
global ref global ref
int prsblk2(root, command) SYM-TABLE root; int command;
{ word; *hold-label;
char
SYM-TABLE int int
ret-status; prsnum();
if(prslab(hold-label)
ERROR)
==
/
check
/
create
/
get
/
check
for
label
correct
*/
return(ERROR);
crepsd( command) nt
;
pseudo
code
for block
stateme
/ ps-cur->block=
if(((word=
block-number
EOL)
==
getword())
-
1;
||
(word
==
COMMA))
A-operand
/
return(error(REQ-OPER));
if (
isdigit(*word))
for
valid
/
numeric
{ if(prsnum(word,root)
ERROR)
==
return(ERROR); if((word=
else
return
!= getword()) EOL) (error( SYNTAX));
ps-cur->A-operand=
cur-label;
} el se
if(((ret-status=
!= ERROR) && root)) SNA-RANDOM) && (ret-status
prsolb(word,
(ret-status
!=
ps-cur->A-operand=
!=
LAB-STOR))/*
check
for
valid
SNA /
cur-label;
else re turn(error(
NO-OP
ER));
} cur-label=
1f((word=
hold-label; getword())
!=
EOL)
/
make
/
go
sure
that
is
all
on
the
line */
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
ink;
}
242
to new
pseudo
code
statement
/
/+
NAME: prsend
SYNOPSIS: *
int prsend() PURPOSE:
Parse
operands
for END
instruction.
RETURNS: *
ERROR
-
syntatic
detected
error
..
MAINTENANCE: ..
15-June-83
jvd
created
-/
^include
stdio
^include
ctype
(^include
"[vandel Ion
int int int
global ref global ref global ref
int
.
the si
s]gpss"
end-key;
end-line-pointer;
label-light;
prsend()
{ end-1
ine-pointer++;
if(label-light
==
ON)
/
labels
/
check
allowed
not
END /
on
return(error(LAB-NOT-ALW)) ;
if(end-key
==
ON)
for
multiple
END'S
/
return(error(MULT-END)); end-key=
ON;
if(getword()
-/
!=
/
EOL)
return(error(NO-OPER)) ;
243
turn no
end
light found
operands
allowed
on
/
/
/+
NAME: *.
prsf un
.*
SYNOPSIS: *
int prsfun(root) SYM-TABLE
root
PURPOSE: **
Parse
for FUNCTION instruction.
operands
**
RETURNS: ERROR
syntatic
-
error
detected
.. *
MAINTENANCE:
.
15-June-83
jvd
created
** *.
-/
#include
stdio
^include ^include
ctype
global ref global ref
FILE SYM-TABLE
f ileptr; cur-label ;
global ref
char
global ref
int int int
line[]; 1 ine-number; end-1 ine-pointer; 1 ine-pointer;
"[vandel!
global ref global ref
int
on.
thesis]gpss"
prsf un( root) SYM-TABLE "root;
{ char
"word ;
int int int SYM-TABLE int
ret-status ;
T. j: temp ;
hold-label prsf
lo();
if(prslab(hold-label) return(ERROR)
ERROR)
==
LAB-FUNC;
cur-label->attr-pnt->lab-attribute=
if(((word=
/
check
/
put
FUNCTION
get
the
for
label
valid
/
;
(w->rd
EOL) ||
==
getword())
==
COMMA))
/
in
label
A-operand
symbol
table
*
/
return(error(REQ-OPER)); !=
if (strcmp(word,"r")
0)
{ if (strcmp(word,"R")
!=
/
make
/
get
comma
get
B-operand /
sure
A-operand
random
in
/
number
*/
0)
return(error(NO-OPER))
;
} i-f((word=
getword()) EOL) return(error(REQ-OPER) ) ; != else if(word COMMA) ==
syntax
return(error(NO-OPER)) ; if(((word=
getword())
==
(word
EOL) ||
==
COMMA))
/*
return(error(REQ-OPER));
if((word
==
'D')
||
('word
==
/
'd'))
only
valid
function is discrete /
{ word++;
if(prsnum(word.
FUNCTION)
==
ERROR)
return(error(ILL-OPER)) ; cur-label->attr-pnt->leng-info=
mbol
table
cur-label
->attr-pnt->func-spec=
atoi
(word)
;
/
update
info in sy
/
cur-label->attr-pnt->pnt-info=
cur-label->attr-pnt->f
lo-num=
( int) cur-label->attr-pnt->leng-info) ; (double) cur-label->attr-pnt->leng-info)
malloc(sizeof malloc(sizeof
}
244
;
else
return(error(ILL-OPER)); !=
1f(getword()
EOL)
/
make
/
get
/*
print
sure
else
nothing
line
on
/
return(error(SYNTAX));
if(fgets(l1ne,MAXLINE,fileptr) 1
!=
NULL)
function trailer
/
card
1ne-number++;
end-line-pointer=
1 ine-pointer=
%s"
printf("%d\t
,1
0;
ine-number,l
temp=
ine)
;
cur-label->attr-pnt->leng-info; for(j= 0, i= cur-label->attr-pnt->leng-info
if(prsflo(j)
==
i
;
>
0
;
card
/
1--)
ERROR)
return(ERROR); if((word=
j++,
trailer
getword())
!=
COMMA)
/
check
for
/
check
for COMMA /
floating
valid
point
/
return(error(SYNTAX)); if(((word=
==
getword())
EOL) ||
(word
==
COMMA))/*
get
next
in function
number
trailer
/
return(error(SYNTAX));
if (isdigit(*word))
/
{ if(prsnum(word,FUNCTION)
==
check
for
valid
number
/
ERROR)
return(error(ILL-FUNC)); else
*((cur-label->attr-pnt->pnt-info) *bol
j)=
+
atoi
(word)
;/
put
info
into
sym
table /
} el se
return(error(MIS-FUNC)); if((((word=
getword()) == (word == COMMA))
EOL)
&& ((i
-
1)
!=
0))
||
/
check
/
make
/
no
for
'/'
between
data
or
..
return(error(ILL-FUNC)); else
if(word
!=
EOL)
{ if (1 ine[end-l
ine-pointer]
!=
'/')
return(error(ILL-FUNC)) ; else end-1
ine-pointer++;
} } if(getword()
!=
EOL)
sure
no
more
return(error(SYNTAX));
} else
return(error(PRE-END)) ;
}
245
trailer
card
*/
on
line
*/
EOL /
/*+ **
NAME:
*
prsgat
SYNOPSIS: int prsgat(root)
SYM-TABLE
"root
PURPOSE: Parse operands for GATE
instruction.
RETURNS: ERROR
if
-
found
error
in parsing GATE
..
statement
MAINTENANCE: 15-June-83
jvd
created
-/
^include ^include ^include
ctype
globalref
SYM-TABLE *cur-label;
stdio
"[vandel Ion thesis ]gpss" .
global ref
char
globalref
CODE int
globalref
temp-label[]; 'ps-cur; block-number;
int prsgat(root) SYM-TABLE 'root;
{ char
word ;
char
option[4];
int SYM-TABLE CODE
ret-status; hold-label ;
back-link;
if(prslab() bel
==
ERROR)
/
check
/
return(ERROR)
for correct la
;
hold-label=
cur-label; crepsd(GATE); ps-cur->block= block-number ps-cur->B-operand=
if(((word=
1;
-
NULL;
getword())
==
|| (word
EOL)
return(error(REQ-OPER) )
==
COMMA))
/
A-operand /
get
; "NU"
if((strcmp(word."U") != 0) && (strcmp(word, ) != 0) && (strcmp(word,"SF") != 0) && ( strcmp(word, "SE") != 0) && (strcmp(word,"u") != 0) && ( strcmp(word, ) != 0) && (strcmp(word,"sf ") != 0) && ( strcmp(word ) != 0) &&
else
"nu"
"se"
,
(strcmp(word,"SNE")
!=
(strcmp(word, "snf ")
!=
&& &&
0) 0)
( strcmp(word, ( strcmp(word
"sne"
) )
"SNF"
.
!= !=
monic /
return(error(
ILL-OPT))
0) && 0))
/
check
for
valid
mneu
;
else
{ strcpy(option,word,3) r
use
/
;
/ option[3]=
=
0))
if((strcmp(word,"SF") ==0) || (strcmp(word,"sf ")
==
0))
==
0))
NU;
SF;
if((strcmp(word,"SE") ==0) ps-cur->operator=
==0)
|| (strcmp(word,"snf ")
0))
SNF;
if((strcmp(word,"SNE") ps-cur->operator=
|| (strcmp(word, "se")
SE;
if((strcmp(word,"SNF") ps-cur->operator=
else
0))
|| (strcmp(word,"nu")
ps-cur->operator=
else
for late
U;
1f((strcmp(word,"NU") ==0) ps-cur->operator=
else
|| (strcmp(word, "u")
==0)
ps-cur->operator=
else
option
NULL;
if((strcmp(word."U") else
save
'
==0)
||
(strcmp(word,"sne"
)
==
0))
SNE;
} if(((word=
getword())
==
EOL) ||
(word
==
COMMA)) 246
/
get
B-operand /
return(error(REQ-OPER) )
; /
if( isdigit(word) )
else
valid
/
numeric
{ if (prsnum(word. root) == return(ERROR);
ERROR)
} if(((
else
ret-status=
prsolb(word
return(error(NO-OPER)) if((ret-status A
and
not
and
not
return(error(NO-OPER))
SNA
/
!=
's'))
!=
LAB-STOR))
/
check
for
storage
SN
(ret-status
/
check
for storage
mn
;
cur-label;
cur-label=
hold-label;
back-link=
ps-cur;
ps-cur=
valid
SNA /
storage
ps-cur->A-operand=
SNA-RANDOM))/*
;
"s") &&
==
(ret-status
ERROR) ||
/
mneumonic
if((option[0]
eumonic
)
;
return(error(NO-OPER)) else
root)
LAB-STOR) && (option[0]
==
storage
.
ps-cur->code-l
ink;
crepsd(BNE) ; block-number
ps-cur->block=
ps-cur->B-operand=
if((word=
-
1;
NULL;
EOL)
getword())
/
ok
/
check
/
get
/
check
if
C-operand
no
/
{ temp-label[3]=
NULL;
if((ret-status=
re
strlab(
ps-cur->A-operand=
cur-label cur-
label
root
temp,strcat(
,
itoa( ))
,0))
ERROR]
cur-label;
->attr-pnt->lab-attribute=
cur-label->attr-pnt->pnt-info=
ps-cur->code-l
LAB-LABEL;
1 ;
->attr-pnt->leng-info=
cur-label->attr-pnt->pnt-info=
ps-cur=
label
turn(error( COMPILER) );
malloc(sizeof(int)); back-1 ink;
ink;
return(SUCCESS);
} if(word
else
ar COMMA
!=
COMMA)
for
special
ch
/
return(error(SYNTAX)); if(((word=
EOL) getword()) return(error(REQ-OPER) ) ; if (
else
==
||
(word
COMMA))
==
isdigit('word))
C-operand / for alpha,
lab
more
Tin
/
el
return(error( if((ret-status=
ILL-LAB) )
strlab(
;
root
.word,
ps-cur-
>A-operand=
ps-cur-
>A-operand->label=
mal
loc(
SEARCH) )
ERROR)
( SYM-TABLE)) ; loc(strlen(word)
si zeof mal
strcpy(ps-cur->A-operand->label .word)
(ps-cur->A-operand->label
==
+
ps-cur->A-operand->attr-pnt=
+
1);
;
(strlen(word)
+
1))=
NULL;
LAB-LABEL;
} else ps-cur->A-operandx
if(getword() e
error
!=
ret-status; /
EOL)
/
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
Ink;
}
247
anything
on
/+
NAME: prsgen
SYNOPSIS: int prsgen(root) SYM-TABLE Toot;
*. *
PURPOSE: Parse
operands
for GENERi
*.
RETURNS: ERROR
-
syntatic
error
MAINTENANCE:
15-June-83 18-Mar-84
jvd jvd
created added
pseudo
code
generation
-/
^include
stdio
^include ^include
ctype
global ref
CODE *ps-cur-; SYM-TABLE *cur-label; int block-number;
"[vandel Ion.
global ref global ref
thesis]gpss"
int prsgen(root) SYM-TABLE *root;
{ char
*word;
SYM-TABLE int
*hold-label=
NULL;
ret-status;
if(prslab(hold-label)
===
ERROR)
/*
check
/*
create
for
correct
label
/
return(ERROR); crepsd(GENERATE); ps-cur->block= block-number if(((word=
pseudo
translation
*/
1;
EOL) getword()) return(error(REQ-OPER)) ; ==
||
(word
==
COMMA))
if (isdigit(*word))
/*
get
/*
check
A-operand
for
*/
numeric
*/
{ if(prsnum(word, root)
==
ERROR)
return(ERROR); ps-cur->A-operand=
if(((ret-status=
else
&& (ret-status
!=
ps-cur->A-operand=
cur-label;
prsolb(word
,
root))
SNA-RANDOM) &&
!=
ERROR)
(ret-status
!=
&& (ret-status
SNA-PARAM)
)/
!=
LAB-STOR)
check
for
legal
SNA /
cur-label;
else
return(error(NO-OPER)) ; cur-label=
hold-label;
if ((word
getword())
=
==
/
EOL)
{ ps-cur->B-operand=
ps-cur=
/"
NULL; ink;
/
ps-cur->code-l
/
return(SUCCESS);
get
B-operand */
B-operand / ready for next translation / B-operand not required /
no
get
} else
if(word != COMMA) return(error( SYNTAX));
if(((word=
getword())
==
EOL)
||
(word
==
COMMA))
return(error(SYNTAX)); /
if (isdigit('word))
if(prsnum(word, root)
==
ERROR)
return(ERROR); ps-cur->B-operand=
cur-label;
} 248
check
for numeric /
else
if(((ret-status*
&& (ret-status
!=
ps-cur->B-operand=
prsolb(word
SNA-RANDOM)
,
!= ERROR) && (ret-status root)) && (ret-status != SNA-PARAM) )/
!=
LAB-STOR)
check
for
legal
SNA /
cur-label;
el se
return(error(NO-OPER)) cur-label=
;
hold-label;
if(getword()
!=
/
EOL)
anything
else
on
line
/
return(error(SYNTAX)); ps-cur=
ps-cur->code-l
/
ink;
>
249
get
ready for
next
translation
/
/*+ *
NAME: prssim
** **
SYNOPSIS
*
int prssim()
* **
PURPOSE:
**
Parse SIMULATE
operands.
** *
RETURNS:
ERROR
-
syntatic
error
detected
MAINTENANCE:
15-June-83
jvd
created
** **
-/
#incl
ude
stdio
^include ^include
ctype
global ref
int int
"[vandellon.thesis]gpss"
global ref
int
simulate-key;
label-light;
prssiir'()
{ word ;
char
if(label-light
==
ON)
return(error( LAB-NOT-ALW) if (simulate-key
==
)
/
label
not
allowed
/
check
for
multiple
/
turn
/
no
/
;
ON)
SIMULATE
statemen
/
ts
return(error(MULT-SIM)); simulate-key=
if((word=
ON;
getword())
==
EOL)
return(SUCCESS); else
if (word
==
COMMA)
return(error(SYNTAX)) ; else
return(error(NO-OPER)) ;
}
250
on
SIMULATE found /
oeprands
allowed
on
SIMULATE /
/+
NAME: *
prssto
SYNOPSIS: *
int prssto(line)
"line;
char *
PURPOSE: Parse
**
for STORAGE
operands
instruction
RETURNS: Unknown MAINTENANCE:
*.
15-June-83
jvd
created
.. -/
^include
stdio
^include ^include
ctype
global ref
int label-light; SYM-TABLE cur-label
"
global ref
int
[vandel! on.
thesis]gpss"
;
prssto(root) SYM-TABLE
root;
{ SYM-TABLE int
number;
char
word;
'ret-status;
if(label-light
!=
/
ON)
return(error(LAB-REQ))
label
reuired
/
; /
LAB-STOR;
cur-label->attr-pnt->lab-attribute=
if (isdigit(cur-label->label[0]))
put
/
is
/
get
info
into
current
symbol
label
a
/
table
digit,
legal
/
{ if(prsnum(cur-label->label retu rn
==
.STORAGE)
( error ( ILL-LAB))
ERROR)
;
} if(((word=
EOL) ||
getword())
(word
==
COMMA))
A-operand
/
return(error(REQ-OPER));
if ( isdigi t(*word)
else
/
)
valid
numeric
/
{ number=
atoi(word);
cur-label
ge
->attr-pnt->l
eng-info
-
cur-label->attr-pnt->f
unc-spec=
number;/*
tell
amount
of
stora
/ cur-label->attr-pnt->pnt-info
=
malloc(number)
;
/
get
/
Operand
a
place
for
storage
/
} else
return(error(NO-OPER)) ; unless
numeric
if((word=
retu
is
not
valid
in
this
/ /
!=
EOL) getword()) rn(error( SYNTAX));
}
251
anything
else
on
the
line /
version
/+
NAME: *.
prsstr
*.
SYNOPSIS:
int prsstr(line)
*
"line;
char
.*
PURPOSE: **
Parse
operands
for START instruction.
*
RETURNS: *.
ERROR
-
syntatic
detected
error
*
MAINTENANCE:
15-June-83
jvd
created
.. .*
^include ^include ^include
stdio
global ref
int label-light; INFO-STRT strt[]-, int strt-ptr;
ctype
"[vandel Ion
global ref global ref
int
prsstr(root
.
thesis]gpss
)
SYM-TABLE
root
char
word ;
SYM-TA8LE int
ret-status;
;-
{ number;
if(label-light
==
/
ON)
return(error(LAB-NOT-ALW)) if(((word=
==
getword())
label
not
allowed
/
;
EOL) ||
(word
==
/
COMMA))
get
A-operand
set
up for
/
return(error(REQ-OPER));
if (isalpha(*word))
else
ED)
/
assignment
values
/
{ if((ret-status=
else
strlab( root word, SEARCH) ) return(error(UN-OPER)) ; if(ret-status->attr-pnt->lab-attribute
==
,
return(error(NO-OPER))
ERROR) !=
LAB-ASSIGN)
;
else
{ if(strt-ptr
==
49)
return(error(TOO-START)) ; strt[strt-ptr]=
mal
loc(sizeof( INFO-STRT) )
strt[strt-ptr]->sim-time=
;
( ret-status->attr-pnt->pnt-info)
;
} } /
if(isdigit(*word))
else
check
for
valid
{ strt[strt-ptr]= number=
malloc(sizeof
( INFO-STRT))
;
atoi(word);
strt[strt-ptr]->sim-time=
number;
} if((word=
getword())
==
/
EOL)
(strt[strt-ptr])->print=
get
B-operand /
PRT;
strt-ptr++; return(SUCCESS);
} if(word
else
==
/
COMMA)
{ if((word=
getword())
==
/
EOL)
return(error(SYNTAX));
} else return(error(SYNTAX));
252
comma
get
there
/
C-operand /
numeric
/
(NOT U
if(word
COMMA)
==
/
(strt[strt-ptr])->print=
if((strcmp(word,"NULL")
else
(strt[strt-ptr])->print= else
fin
in snap
print
count
time
/
PRT; ==
0) || (strcmp(word,
"nul 1
")
==
0))
PRT;
if((strcmp(word,"NP") ==0) (strt[strt-ptr])->print= NP;
|| (strcmp(word. "np")
==
0))
'
else
return(error(NO-OPER)); 1f((word=
getword())
==
EOL)
return(SUCCESS); else if(word == COMMA)
{ if ((word"
getword()) == EOL) return(error(SYNTAX));
if(isalpha(word)) ED)
/
/
{ if((ret-status=
strlab( root, word,
return(error(UN-OPER)) else
if (ret-status
!=
SEARCH))
;
LAB-ASSIGN)
return(error(NO-OPER) )
;
else
} if(isdigit(*word))
else
{ number?
atoi(word);
strt[strt-ptr]->interval-print=
number;
} else
if(*word
==
NULL)
strt[strt-ptr]->
interval -print* 0;
strt-ptr++;
253
==
ERROR)
set
up
for
assignment
values
(NOT US
/*+
NAME: ..
prater
.
SYNOPSIS: int prster(root) PURPOSE: Parse operands
for TERMINATE
instruction.
RETURNS: .*
Unknown
**
MAINTENANCE: .*
15-June-83 18-Mar-84
..
jvd jvd
created added
pseudo
code
generation
..
^include
stdio
^include
ctype
^include
"[vandellon.
global ref
CODE *ps-cur; SYM-TABLE cur-label ; int block-number;
global ref
global ref
thesis]gpss"
int prster(root) SYM-TABLE "root;
{ char
"word;
SYM-TABLE int int
*hold-label=
NULL;
ret-status;
prsnum();
if(prslab(hold-label)
==
/
ERROR)
check
for
label
valid
/
return(ERROR); /
crepsd(TERMINATE); ps-cur->block= block-number ps-cur->B-operand=
if((word=
/
NULL;
getword())
==
EOL)
{ if(prsnum("l",root)
==
create
pseudo
code
structure
/
1;
ERROR)
no
B-operand /
/
ok
if nothing
/
put
in default
/*
get
ready for
/
COMMA NO INO!
on
else
for terminate
1
of
line */
s
atement / return(error(SYNTAX)) ; ps-cur->A-operand= ps-cur=
cur-label;
ps-cur->code-l
ink;
next
line
of
code
/
return(SUCCESS);
} if(word
else
==
COMMA)
/
return(error(SYNTAX)); else
{
/
if (isdigit(*word)) if (prsnum(word.root)
==
valid
numeric
/
ERROR)
return( ERROR); ps-cur->A-operand=
/*
cur-label;
info
into
pseudo
anything
else
on
put
code
/
} else
return(error(NO-OPER)) ;
} cur-label=
if((word=
hold-label; getword())
!=
/
EOL)
the
line */
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
/
ink ;
}
254
get
ready for
next
line
of
code
*/
/+
NAME: prster .*
SYNOPSIS: *
int prster(root)
..
PURPOSE: .*
Parse
operands
for TERMINATE instruction.
..
RETURNS: ..
Unknown
..
MAINTENANCE: ..
15-June-83
..
18-Mar-84
jvd jvd
created added
pseudo
code
generation
.. -/
^include
stdio
^include
ctype
^include
"[vandel! on.
global ref
CODE *ps-cur; SYM-TABLE cur-label; int block-number;
global ref global ref
thes1s]gpss"
int prster(root) SYM-TABLE "root;
{ char
*word;
SYM-TABLE int int
*hold-label=
NULL;
ret-status;
prsnum();
if(prslab(hold-label) return(ERROR)
==
/
ERROR)
/
crepsd(TERMINATE); ps-cur->block=
block-number
ps-cur->B-operand=
if((word=
check
for
valid
label
/
;
-
/
NULL;
getword())
==
create
pseudo
code
structure
/
1;
EOL)
no
B-operand
/
/
ok
if nothing
else
on
/
get
ready for
next
line
/
COMMA NO INO!
/*
valid
line /
{ NULL; ink;
ps-cur->A-operand= ps-cur=
ps-cur->code-l
of
code
/
return(SUCCESS);
} if(word
else
==
COMMA)
/
return(error( SYNTAX)); else
{ if(isdigit(*word))
numeric
*/
{ if(prsnum(word,root)
==
ERROR)
return( ERROR); ps-cur->A-operand=
/
cur-label;
info
into
pseudo
anything
else
on
put
code
/
} else
return(error(NO-OPER)) ;
} cur-label=
if((word=
hold-label; getword())
!=
/
EOL)
the
line */
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
/
ink;
}
255
get
ready for
next
line
of
code
/
/+
NAME: *
prstst
* *
SYNOPSIS: int prstst(root) SYM-TABLE
*root;
PURPOSE:
Parse
for TEST instruction.
operands
..
RETURNS: ..
ERROR
error
-
parsing the TEST
when
statement
*.
*
MAINTENANCE: 15-June-83
jvd
created
*.
.. -/
^include #include ^include
stdio
globalref
SYM-TABLE *cur-label CODE *ps-cur;
;
globalref globalref
char
temp-label[]
;
globalref
int
block-number;
ctype
"[vandel Ion
thesis]gpss" .
int prstst(root) SYM-TABLE root;
{ *word;
char
int SYM-TABLE CODE
ret-status; .
if(prslab()
hold-label; back-link; =.=
ERROR)
/
check
/
get
/
test
for
valid
label
/
return(ERROR) ; crepsd(TEST); ps-cur->block=
hold-label=
block-number
-
if(((word=
getword()) EOL) return(error(REQ-OPER) ); ==
if ((strcmp(word,"E")
(strcmp(word,"L") (strcmp(word,"G") else
!=
!=
!=
if
"e"
,
,
)
) )
!=
!=
0) 0))
!=
|| (strcmp(word,
0) &&
"e"
mneumonic
for
option
legal
/
option
/
&&
)
==
0))
|| (strcmp(word,"l")
==
0))
0) || (strcmp(word,"g)
==
0))
"L"
==0) LT
((strcmp(word,"G"
ps-cur->operator=
GT
if(((word=. getword())
==
red
COMMA))
EQ;
ps-cur->operator=
else
==
&& (strcmp(word " && (strcmp'word "1 "g" && (strcmp(word,
return(error(ILL-OPT)) ; if ((strcmp(word,"E") ==0) if ((strcmp(word,
(word
||
0)
0) 0)
ps-cur->operator=
else
1;
cur-label;
EOL)
||
(word
==
COMMA))
/
get
B-operand. first SNA
to
be
/ return(error(REQ-OPER)); /
if (isdigit(*word))
if (prsnum(word, root)
==
check
for numeric B-operand /
ERROR)
return(ERROR);
else
if(((ret-status=
||
(ret-status
==
prsolb(word
,
root)
)
==
ERROR) || (ret-status /
SNA-RANDOM))
==
LAB-STOR)
check
for valid SNA /
check
for COMMA /
return(error(NO-OPER)); ps-cur->A-operand=
cur-label=
if(((word=
cur-label;
hold-label; getword())
==
EOL)
||
(word
!=
COMMA))
/
||
(word
==
COMMA))
/
retun(error(SYNTAX));
if(((word=
getword())
==
EOL)
256
get
C-openninH,
smamma
s,
__
compa
/
return(error(REQ-OPER));
if(1sdigit(word))
/
if (prsnum(word, root) == return(ERROR);
check
for
operand
numeric
/
ERROR)
} if(((ret-status=
else
|| (ret-status
prsolb(word
==
==
.root))
ERROR) ||
(ret-status
SNA-RANDOM))
==
LAB-STOR)
/
check
for
valid
/
check
for
optional
SNA /
return(error( NO-OP ER)); ps-cur->B-operand= cur-label=
back-link= ps-cur=
cur-label;
hold-label; ps-cur;
ps-cur->code-l
ink;
crepsd(TEST); ps-cur->block=
block-number
if(((word=
-
1;
NULL;
ps-cur->B-operand=
==
getword())
EOL) ||
!=
(word
COMMA))
/
comma
BNE; NULL;
ps-cur->operator=
temp-label [3]=
if ((ret-status= retu
strlab( root strcat( temp-label rn(error( COMPILER)) ; ,
ps-cur->A-operand=
cur-label
itoa( ))
,0)
)
==
ERROR)
cur-label;
->attr-pnt->lab-attribute=
LAB-LABEL;
1 ;
cur-label->attr-pnt->leng-info=
loc(sizeof ( int
cur-label->attr-pnt->pnt-inf o=
mal
cur-label
back-1
ps-cur=
,
->attr-pnt->pnt-info=
ps-cur->code-l
))
;
ink;
ink;
return(SUCCESS);
} if(((word=
==
getword())
EOL) ||
(word
/
COMMA))
==
get
D-operand,
which
is
a
label
return(error(SYNTAX));
if (isdigit(*word)
return(error( ps-cur->operator=
if
((ret-status=
) ILL-LAB))
;
BNE;
strlab( root, word,
SEARCH))
==
ERROR)
{ malloc(sizeof
ps-cur->A-operand=
ps-cur->A-operand->label=
strcpy(ps-cur->A-operand->label
*(ps-cur->A-operand->label
(SYM-TABLE))
;
malloc(strlen(word) +
ps-cur->A-operand->attr-pnt=
.word)
+
1);
;
(strlen(word)
+
1))=
NULL;
LAB-LABEL;
} el se ps-cur->A-operand=
if((word=
getword())
ret-status;
!=
/
EOL)
return(error(SYNTAX));
ps-cur=
ps-cur->code-l
ink;
}
257
anything
else
on
the
line
/
*/
/*+ *
NAME:
..
prsvar
..
SYNOPSIS: ..
int prsvar(root) SYM-TABLE
..
'root;
*
PURPOSE: *
Parse
for VARIABLE instruction.
operands
RETURNS: ERROR *
-
syntactic
error
detected
MAINTENANCE:
.
21-Jan-84
jvd
created
** * -*/
^include
stdio
^include
ctype
^include
"[vandellon. thesis ]gpss"
global ref global ref
int label-light; SYM-TABLE cur-label;
global ref
char
line[];
globaldef
int
unary=
0;
int prsvar(root) SYM-TABLE root;
{ char
"word;
char
*strip-pnt; 'hold-label;
SYM-TABLE. unary=
0;
hold-label=
cur-label; if (label-light != ON)
/
return(error(LAB-REQ))
check
for
required
check
for
valid
label
/
;
el se
{ if(prslab()
==
/
ERROR)
label
/
return( ERROR); cur-label->attr-pnt->lab-attribute=
LA8-VAR;
} cur-label->attr-pnt->pnt-info=
malloc(sizeof
cur-label->attr-pnt->pnt-info=
(int)
80);
allocate
space
for
postfix
on
line /
notation
NULL; /
if((word=
else
/
getvar()) == EOL) return(error(REQ-OPER)) ; if(word == ERROR)
first
get
value
return(ERROR);
if((word /
else
==
DIVISION) ||
(word
==
MULTIPLICATION)
||
(word
ADDITION))/*
==
if *,
/.
or
+
firs
thing ERROR
return(error(ILL-VAR-DEF));
if(word
else
==
/
SUBTRACTION)
{ '
unary=
/
YES;
if((word=
getvar())
==
/
EOL)
/
return(error(REQ-OPER)); else
if(word
==
'-'
unary
operator
set
negative
unary
get
a
or
1f
number
none
there
found / /
flag
variable
/
ERROR /
ERROR)
return(ERROR); else
if((word == || (word
ADDITION) || (word DIVISION)) ==
==
SUBTRACTION) || (word /
==
more
MULTIPLICATION) operators
are
you
nuts
ERROR
'
return(error(ILL-VAR-DEF));
} if (
/
isdigit(*word))
/
if(prsnum(word, VARIABLE) return(ERROR);
}
==
ERROR)
if
you
have
a
number
make
sure
val
^
if(prsolb(word,root)
else
strip-pnt=
!=
ERROR)
/
if
an
SNA
make
sure
valid
/
strpbrk(word,"*");
strcpy(word,(strip-pnt+l))
;
else
return(ERROR) cur-label=
;
hold-label; /*
put
strcat(cur-label->attr-pnt->pnt-info,":");
/
terminator
if(unary
/
if unary
strcat(cur-label->attr-pnt->pnt-info,word)
;
YES)
==
conunary( ) while((word=
first
operand
operator
;
getvar())
!=
EOL)
{ if(word
==
ERROR)
break; if((word
==
ADDITION)
||
(word
==
SUBTRACTION))
{ if (vaddsub(word.root)
==
ERROR)
{ word=
ERROR;
break;
} } else
if ((word
MULTIPLICATION) ||
==
(word
==
DIVISION))
{ if (vmuldiv(word, root)
==
ERROR)
{ word*
ERROR;
break;
} } else
return(error(NO-OPER))
;
cur-label->attr-pnt->leng-info=
strlen(cur-label->attr-pnt->pnt-info)
} cur-label->attr-pnt->leng-inf o=
if(word
==
strl en (cur-label ->attr-pnt->pnt-info) ;
ERROR)
return(ERROR); else
return(SUCCESS);
}
259
out
*/
add
to
*/
;
operand
/
/*+
NAME:
conunary SYNOPSIS: int
conunary()
PURPOSE:
Concatinate unary
-
operator
onto
the
current
variable
list.
RETURNS:
MAINTENANCE: 19-Feb-84
jvd
created
-/
^include ^include
stdio
global ref
SYM-TABLE *cur-label; int unary;
"[vandellon.thesis]gpss"
global ref
int conunary()
{ s treat
(cur-label
->attr-pnt->pnt-info,
strcat(cur-label->attr-pnt->pnt-info, unary=
"-") "
:
")
;
;
NO;
260
/
concatinate
/
terminate
/
'-'
unary
onto
string
/+
NAME: ..
error
.*
SYNOPSIS: .*
int error(error-num) int error-num;
..
..
PURPOSE: Error
for the
routine
gpss
parser
..
RETURNS: ..
ERROR
-
error
..
signifying
syntatic
error
MAINTENANCE: *
27-June-83
jvd
created
-/
^include
stdio
^include
"[van del Ion. thesis ]gpss"
global ref
char
global ref
int int int int
global ref global ref
global ref
int
line[81]; 1 ine-number ;
block-number; end-1
ine-pointer
error-count ;
error( error-num) int error-num;
r
i
int
i ;
char
temp-
line[81];
for(i=
0 ; i < (end-line-pointer ' ' temp-1 ine[i ]= ;
10)
+
temp-1 ine[(end-l ine-pointer
+
10)]=
temp-1 ine[(end-l ine-pointer
+
11)]=
swi
;
i++)
''; NULL;
tch( error-num)
{ case(NO-END): printf("\n>>
No
END
statement
encountered\n"
)
;
break; case(REQ-OPER):
%s\n",
printf("
temp-1
>>
printf("
ine);
Required
operands
missing\n");
break; case(LAB-NOT-ALW):
%s\n", temp-line);
printf("
>>
printf("
Label
not
allowed\n");
break; case(NO-OPER): 7.s\n"
printf("
,
temp-1
ine)
;
>> Operand
printf("
is
not
valid\n");
break; case(UN-OPER):
%s\n",
printf("
temp-1
ine);
>> Undefined
printf("
operand\n");
break; case(SYNTAX): %s\n"
printf("
,
temp-line) >>
printf("
Syntax
;
error\n");
break; case(ILL-OPT):
%s\n",temp-line);
printf("
>>
printf("
Illegal
option
specif
ied\n")
;
break; case(ILL-LAB): printf("
%s\n", temp-line); >>
printf("
Illegal
specification
break; case(OPEN-ERR):
printf(">>
Open
error
on
input
file\n");
261
of
label\n");
break; case(REP-LABEL): printf("
%s\n", temp-1 ine);
printf("
>>
defined labelNn");
Multiply
break; case(MULT-SIM): %s\n"
printf("
temp-line)
, printf("
;
Multiple SIMULATION statements\n") ;
>>
break; case(MULT-END): %s\n"
printf("
.temp-line) printf("
;
>> Multiple
END statementsXn") ;
break; case(TOO-START): %s\n"
printf("
temp-1
,
printf
("
ine)
;
50 START
>>
statements
allowed\n");
break; case(LAB-REQ): %s\n"
printf("
temp-line)
, printf("
Label
>>
;
required\n") ;
break; case(ILL-NONNUM): printf("
%s\n",
printf("
temp-1
ine); quantity\n"
Illegal
>>
specification
of
numeric
specification
of
operand\n");
break; case(ILL-OPER): %s\n"
printf("
, printf("
temp-1
ine)
;
Illegal
>>
break; case(LAB-NO-STAT): printf
(
%s\n"
"
,
printf("
temp-1
ine)
Label
>>
;
but
valid
no
statement\n") ;
break; case(PRE-END): printf printf
(
"
%s\n" ,
("
temp-1
ine)
;
Premature
>>
end
file\n");
of
break; case(ILL-FUNC): printf
(
"
%s\n" ,
printf("
temp-1
ine)
;
function def
Illegal
>>
inition\n"
)
;
)
;
break; case(MIS-FUNC): printf printf
(
%s\n"
"
,
("
temp-1
ine) ; Missing function
>>
def ini
tion\n"
break; case(OP-NVLD): %s\n"
printf("
.temp-line)
printf
(
"
;
>> Operand
not
in
valid
this
version\n");
break; case(ILL-VAR-DEF): %s\n"
printf("
,
temp-1
ine)
;
Illegal
>>
printf("
variable
def initionW) ;
break; case(PARlO): printf
(
%s\n"
"
,
temp-1
>> A
printf("
ine)
;
maximum
of
10
parameters
are
allowed\n");
break; case(COMPILER): %s\n"
printf("
,
temp-1
ine)
;
COMPILER error\n");
>>
printf("
break; case(UN-LABEL): printf(">>>
Undefined
label
SIMULATOR
ERROR >>
out
of
range
or
undef
break; case(FINISH-ERR):
printf
("\nTotal
number
printf ("\nSimulation printf("
of
phase
%d"
errors will
GPSS exiting
-
.error-count
not
occur
*\n");
break; error-count++;
return(ERROR) ;
262
due
to
)
;
ERRORSW);
ined\n")
/+
NAME: **
getvar
* *
SYNOPSIS:
*getvar()
char
PURPOSE: *
Get
a
from
word
a
line.
variable
RETURNS: WORD
-
char
pointer
to
the
gotten
word
MAINTENANCE:
9-June-83
jvd
created
-/
^include ^include ^include
stdio
globalref
char
globalref
int int
ctype
"[vandel Ion. thesis
globalref
]gpss"
line[]; line-pointer; end-line-pointer;
*getvar()
char
{ static
word[80]=
char
int
if(
end-line-pointer
return(EOL) while(( *t
0;
i;
isspace(
==
79
/
)
for
check
end
of
line
/
;
1 ine[end-l
&& (end-line-pointer
ine-pointer]) )
!=
79))/*
skip
over
white
space
to
nex
/
word
end-1
ine-pointer++;
1 ine-pointer= ent / if (1 ine[end-l
/
end-line-pointer',
ine-pointer]
==
/
NULL)
beginning &
make
for
check
end
end
of
pointer
line
equival
by line feed
*
/
return(EOL) if ((1
else
;
ine[end-line-pointer] '+') || (1 ine[end-l ine-pointer] -') '*') || (1 ine[end-l ine-pointer] || ( 1 ine[end-l ine-pointer] ==
==
==
hmetic
operations
==
'/'))/
check
for
arit
/
{ end-1
ine-pointer++;
return( 1 ine[end-l ine-pointer
-
1]);
} if (1
else
ine[end-line-pointer]
/
=='!')
check
for
comment
/
return(EOL) ; if ((1 ine[end-l ine-pointer] == 'v') (1 ine[end-l ine-pointer] == 'p') (1 ine[end-l ine-pointer] == 'f')
**ure
if ((line[end-l ine-pointer specification /
+
1]
||
j| jj ==
(1 ine[end-l ine-pointer] == (line[end-l ine-pointer] == (1 ine[end-l ine-pointer] ==
'') ||
'V') || 'P') || 'F'))
(1 ine[end-l ine-pointer
+
1]
==
'n'))/*
want
to make
s
correct
else
return(error(SYNTAX)); for(i=
0
;
( er
attr-pnt->lab-attribute
!=
LAB-STOR)
return(ERROR); else
{ /
cur-label=
ret-root; return(LAB-STOR);
pass
info back to
routine
/
}
} if((temp[0]
else
!=
if((ret-root=
'p')
strlab(
&&
(temp[0]
root
.word
!=
'P')) ==
.SEARCH))
ERROR)
{ error(UN-OPER);
return(ERROR);
} if(ret-root->attr-pnt->lab-attribute
==
SNA-PARAM)
return(ERROR);
if(((temp[0]
==
'r') || (temp[0]
==
'R')) && (
ret-root->attr-pnt->lab-attribute
==
SNA-RANDOM))
return(SNA-RANDOM); else
if(((temp[0]
==
'v') || (temp[0]
==
'V')) && (
ret-root->attr-pnt->lab-attribute
==
LAB-VAR
'))
{ cur-label=
return
else
/*
ret-root;
info back to
routine
*/
ret-root->attr-pnt->lab-attribute
==
pass
(LAB-VAR);
} if(((temp[0]
==
'f') || (temp[0]
==
'F')) && (
C))
{ cur-label=
/*
ret-root;
return(LAB-FUNC);
> else
return(ERROR);
} else
return(ERROR)
;
}
274
pass
info back to
routine
/
LAB-FUN
/+
NAME: **
strlab
SYNOPSIS: ..
SYM-TABLE "strlab( root text-label SYM-TABLE "root; .
char
"text-label;
int
key;
,key)
PURPOSE: ..
Store the a
label a
variable,
in
the
The table. label.
symbol
function,
or
label
can
be storage,
lowly
a
*.
RETURNS:
REP-LABEL
-
root
label
duplicate
-
error
could
found
-
find label label and return
not
pointer
MAINTENANCE: 31-Sept-83
jvd
created
-/
^include
stdio
^include
descrip
^include ^include
ssdef
globalref
int end-line-pointer; int line-pointer; SYM-TABLE *cur-label ;
"[vandellon
globalref globalref
SYM-TABLE *strlab( root SYM-TABLE root;
,
.
thesis
text-label
char
text-label ;
int
key;
]gpss"
.key)
{ SYM-TABLE
ret-status;
if((root->label
==
return(ERROR)
NULL) && (key
if((root->label
else
==
SEARCH))
/
can't
find label
/
found
place
/
create
in
table
/
; ==
NULL) && (key
!=
SEARCH))
to
put
new
label
/
{ cur-label= root->left=
root; mal 1 oc(
si
oc( si zeof (SYM-TABLE) ) malloc( (end-1 ine-pointer text- label ); strcpy( root->label root->attr-pnt= mall oc( si zeof ( LAB) ) ; root->right=
structure
for
new
label
/
zeof( SYM-TABLE));
mall
root->label=
; -
line-pointer)
+
2);
,
} else
if(((ret-status=
epeat label
strcmp( text-label
,
root->label
==
0) && (key /
return(REP-LABEL); else
))
!=
SEARCH))/*
make
sure
not
/
if((ret-status
==
0) && (key
==
SEARCH))
/
if so error / found label /
return( root) ; else
if (
ret-status
left)
.text-label
.key));
el se
return(strlab((root->right)
.text-label
.key));
}
275
recursive
search
through
tree
/
a
r
/+ *
NAME: vaddsub
*
SYNOPSIS: int vaddsub(word,
.* . *.
root
,
hold-label)
char
word
SYM-TABLE SYM-TABLE
root; hold-label;
PURPOSE:
Parse
variables
'+'
with
'-'
or
RETURNS: ERROR
-
syntactic
detected
error
MAINTENANCE: .
19-Feb-84
jvd
created
*. -*/
^include
stdio
#include ^include
ctype
global ref
SYM-TABLE *cur-label int unary;
n[vandellon.thesis]gp:
ss"
global ref
int
;
(word, root hold-label ) 'root; char "word; SYM-TABLE hold-label;
vaddsub
,
SYM-TABLE
{ char
operator[2];
char
*strip-pnt;
operator[0]=
word;
operator[l]=
NULL;
if(((word=
== getvar()) EOL) return(error(NO-OPER)) ; == else if(word ERROR)
else
return(ERROR) ; if((word == ADDITION) (word == DIVISION))
||
||
(word
(word
COMMA))
==
MULTIPLICATION) ||
==
return(error( SYNTAX)); if(word
==
SUBTRACTION)
{ unary=
YES;
if(((word=
else
getvar()) EOL) || return(error(N0-OPER)) ; if(word == ERROR) ==
(word
==
COMMA))
return(ERROR); else
if((word (word
==
==
SUBTRACTION) || ADDITION) || (word MULTIPLICATION) || (word DIVISION)) ==
==
return(error(SYNTAX));
} if (isdigit(word))
{ if(prsnum(word, VARIABLE)
==
ERROR)
return(ERROR);
} if(prsolb(word,root)
else
!=
ERROR)
{ strip-pnt=
strcpy(word
cur-label
=
strpbrk(word
,
(strip-pnt
+
,
"")
;
1));
hold-label;
} else
return(ERROR);
strcat(cur-label->attr-pnt->pnt-info,word) ; "
strcat(cur-label->attr-pnt->pnt-info,
:
")
;
276
if(unary
==
YES)
conunary(
)
;
strcat(cur-label->attr-pnt->pnt-
info, opera tor)
;
strcat(cur-label->attr-pnt->pnt-1nfo,":");
}
277
/*+
NAME: *
**
vmuldiv
SYNOPSIS:
int
vmuldiv(word
*
root)
,
*word; 'root;
char
SYM-TABLE PURPOSE: ..
Parse
multiplication
division for VARIABLE
and
statement.
..
RETURNS: ERROR
-
syntactic
detected
error
..
MAINTENANCE: 19-Feb-84
jvd
created
.* ..
-/
^include ^include ^include
stdio
globalref
globalref
SYM-TABLE cur-label; int unary;
globaldef
char
*ame
int
ctype
"[vandellon.
thesis]gpss"
temp-label [7]=
{
/
'v'.'l'.'t', NULL };
temporary
variable
n
/
vmuldi v(word
,
root)
char
word;
SYM-TABLE
"root;
{ char
sav-operl[2]-.
char
sav-oper2[2];
char
hold-operand[20]
char
"right; "hold-var; *strrchr();
SYM-TABLE char
right=
'
:
strrchr(cur-label->attr-pnt->pnt-info,
right=
right=
NULL;
sav-oper2[l]=
sav-operl[l]=
;
'
)
/*
;
NULL; strrchr(cur-label
if(right
!=
->attr-pnt->pnt-inf
o
' ,
:
'
)
;
find
right
terminator
most
/
erase
/*
find
next
/
save
operator
/
it / right
most
terminator
*/
0)
{ if((right
1)
+
unary=
==
UNARY)
YES;
else
'(right +1);
sav-operl[0]=
right=
/*
NULL; '
'
right=
strrchr(cur-label ->attr-pnt->pnt-info,
if(right
==
:
)
;
clear
/
get
/
0)
strcpy( hold-ope rand
,cur-label->attr-pnt->pnt-info)
cur-label->attr-pnt->pnt-info=
flag
/
/
position
for
found operand
operand
/
*/
;
NULL;
} else
{ if(*(right
+
1)
==
UNARY)
{ unary=
right= right=
YES; NULL; strrchr(cur-label->attr-pnt->pnt-info
/ .':');
get
position
for
/
if(right
==
/
0)
found
{ strcpy(hold-operand,cur-label->attr-pnt->pnt
cur-label
->attr-pnt->pnt-info=
278
NULL;
operand
/
operand
*
} else
{ strcpy(hold-operand, (right (right + 1)= NULL;
+
1));
} } else
{ strcpy(hold-operand, (right (right + 1)= NULL;
+
1));
}
} } else
/*
if
no
right
terminator
most
/
{ strcpy(hold-operand,cur-label->attr-pnt->pnt-info) ; cur-label->attr-pnt->pnt-info=
/ /
NULL;
operand
copy clear
current
into holder */ label info /
} temp-label[3]=
NULL;
hold-var=
"*ake
/
cur-label; temp-varaible /
if (strlab(root.strcat(temp-label /
,
itoa( )),0)
==
ERROR)
save
current
/
enter
/
give
/
allocate
/
put
variable
'cause
could
into the
temp-variable
m
symbol
table
return(error(SYNTAX)); cur-label->attr-pnt->lab-attribute= cur-label->attr-pnt->pnt-info=
TEMP-VAR;
malloc(sizeof
cur-label->attr-pnt->pnt-info=
(int)
it
status space
temporary
of
for
/
info */
NULL;
strcat(cur-label ->attr-pnt->pnt-info,
strcat(cur-label ->attr-pnt->pnt-info,
if(unary
80);
hold-operand) : ") ;
;
"
/
operand
terminate
into
new
variable
/
*/
YES) );
==
conunary(
sav-oper2[0]=
if(((word=
(word
/
word;
ERROR) || (word MULTIPLICATION) || (word
getvar()) ==
==
save
''
or
'/'
for
later
use
/
ADDITION) || DIVISION))
==
==
return(error(ILL-VAR-DEF)) ; if(word
SUBTRACTION)
==
{ YES;
unary=
if((word=
else
getvar()) == EOL) return(error(N0-OPER)) ; if(word == ERROR)
else
if((word
==
(word
==
return(ERROR);
SUBTRACTION) || ADDITION) || (word MULTIPLICATION) || (word DIVISION)) ==
==
return(error(ILL-VAR-DEF));
} strcat(cur-label
->attr-pnt->pnt-
info, word)
;
strcat(cur-label->attr-pnt->pnt-info,":");
if(unary
YES) );
==
conunary(
strcat(cur-label->attr-pnt->pnt-info,sav-oper2) ; "
strcat(cur-label->attr-pn
:
)
;
strcat(hold-var->attr-pnt->pnt-info,cur-label->label
)
;
strcat(hold-var->attr-pnt->pnt-info,":");
if((right
!=
0)
||
((right
==
0)
&&
(unary
==
YES)))
strcat(hold-var->attr-pnt->pnt-info,sav-operl) ; strcat(hold-var->attr-pnt->pnt-info,"
:");
cur-label->attr-pnt->leng-info=
cur-label=
strlen(cur-label->attr-pnt->pnt-info) ;
hold-var;
}
279
/+
NAME: prsymtab
SYNOPSIS:
prsymtab(root) SYM-TABLE
"root;
PURPOSE:
Printing
***TEST***
table values.
symbol
purposes
only.
RETURNS: Not applicable. MAINTENANCE:
29-Dec-83
jvd
created
-/
^include
stdio
^include
"[vandellon.
thesis]gpss"
int int
count=
globalref globalref
INFO-STRT
*strt[];
globaldef
0;
strt-ptr;
int prsymtab( root) SYM-TABLE "root;
{ Char
hold[10];
int
i ;
if(root->label
NULL)
==
return ;
if(count
0)
==
{ Drintff printf
(
n\n\n********** ************************
"\nSymbol
Table
Contents
First
after
***************\n"
Pass
)
*
Completion");
printf("\n=================================================");
count++;
} printf
("\n\n Label
%s"
:
,root->
label
if((root->attr-pnt->lab-attribute) strcpy(hold, else
,
)
LAB-LABEL)
==
LAB-VAR)
==
TEMP-VAR)
==
LAB-FUNC)
==
CONSTANT)
==
SNA-PARAM)
;
if((root->attr-pnt->lab-attribute) strcpy( hold
==
"LABEL"); "VARIABLE"
else
LAB-STOR)
"STORAGE");
if((root->attr-pnt->lab-attribute) strcpy(hold
else
; ==
if ((root->attr-pnt->lab-attribute) strcpy(hold.
else
)
"TEMPORARY"
,
)
;
if((root->attr-pnt->lab-attribute) strcpy( hold, "FUNCTION");
else
if((root->attr-pnt->lab-attribute) strcpy( hold
else
"CONSTANT" ,
)
;
if((root->attr-pnt->lab-attribute) st
rcpy( hold, "PARAMETER");
1 S6
strcpy(hold,
"****");
hold[strlen(hold)]= printf("\n\tLabel
if (
NULL;
attribute:
root->attr-pnt->leng-info
%s",hold); !=
0)
if(root->attr-pnt->lab-attribute
printf
("\n\tNumber
printf("\tNumber
of
of
for(i=
(
"\n\tNumber
0
;
i
attr-pnt->leng-info %d"
printf("\n\t\t%lf
,
*(
280
(
;
%d" ,
root->attr-pnt->f
i++)
root->attr-pnt->f
lo-n
root->attr-pnt->pnt-inf o
.
.,,,
unc-spec)
;
} printf("\n\tLength
printf printf
%d"
information:
of
if((root->attr-pnt->lab-attribute
,
==
root->attr-pnt->leng-info) ;
LAB-VAR) || (
root->attr-pnt->lab-attribute
==
TEMP-VAR))
("\n\t Information
stored: ") ; ("\n\t\t%s",root->attr-pnt->pnt-info);
} else
if((root->attr-pnt->lab-attribute CONSTANT) || (root->attr-pnt->lab-attribute SNA-PARAM)) ==
==
Information stored:") ; printf("\n\t\t%d",*(root->attr-pnt->pnt-info)); printf("\n\t
!=
if(root->left
NULL)
prsymtab(root->left) if (root->right
!=
;
NULL)
prsymtab( root->right) if(count
;
1)
==
{ printf("\n*
*
\n\n");
printf("=====================\n"); printf ( "START card inf ); ormation\n"
printf("======================\n"); for(i=
0
;
strt-ptr
>
i
;
i++)
{ ("\nSTART card #%d: \tsimulation if(strt[i]->print == PRT)
printf
time
%d\n" ,
( i+1)
,
strt[i
]->sim-time)
;
{ printf
( "\t\tSNAP
interval
printf("\t\tlnterval
requested\n"
)
printout
printout
time
is %d
uni
;
ts\n" ,
strt[
} else printf
("\t\tNO SNAP
interval
} count++;
}
281
requested\n"
printout
)
;
i]->interval-print)
;
12.2. Pass 2 Program Listings.
***
The
NOTE
following
capabilities of
the
***
pages
the
representation
are
the
hardware, for the
an
program
Due to printing listings for the thesis project. character is is an undefined character. The -
underscore
underscore.
282
+
NAME: gps-pass2
SYNOPSIS: int gps-pass2(
)
PURPOSE: Main
for
routine
the
complete
pass2
creation
of
the
the
of
All
compiler. pseudo
code
pass2
does
by filling
in
is labels.
RETURNS: 0
if no errors if errors
-
-
-1
MAINTENANCE: 24-Mar-84
jvd
created
/
^include 0 include
stdio
"[vandel Ion
.
thesis
globalref
char
line[];
globalref
CODE CODE
ps-cur; ps-root;
globalref
]gpss"
int gps-pass2(root)
SYM-TABLE
*root;
CODE int
*ps-work;
{ ret-status;
ps-work=
for(
;
ps-root;
ps-work
!=
ps-cur
;
ps-work =
ps-work->code-l
ink)
{ if ((ps-work->operator
==
(ps-work->operat.or
==
(ps-work->operator
==
(ps-work->operator
==
(ps-work->operator
==
GT) || LT) || NU) || SE) jj SNE))
(ps-work->operator (ps-work->operator (ps-work->operator (ps-work->operator
== == == ==
EQ) || U) | j SF) j| SNF) ||
{ ps-work=
if(
ps-work->code-l
ps-work
==
ink;
ps-cur)
break; else
if (( int)ps-work->A-operand->attr-pnt
==
LAB-LABEL)
{ if
((ret-status=
strlab(root,ps-work->A-operand->label
==
ERROR)
==
ERROR)
.SEARCH))
{ strcpy(l
i
ne.ps-work->A-ope
rand-
> label
)
;
error(UN-LABEL);
} else ps-work->A-operand=
ret-status;
}
} else
if (ps-work->operator
=
BR)
if (( int)ps-work->B-operand->attr-pnt 1f((ret-status=
==
LAB-LABEL)
strlab(root,ps-work->B-operand->label
{ strcpy(l
ine,ps-work->B-ope
rand-
error(UN-LABEL);
} else ps-work->B-operand=
}
} return;
283
ret-status;
> label );
.SEARCH))
/+
NAME: crepsd
SYNOPSIS:
int crepsd(operator) int operator; PURPOSE:
Create the
pseudo
code
structure
for GPSS code
RETURNS: *
No
returning
value.
MAINTENANCE: 18-Mar-84
jvd
created
-/
^include # include
stdio
globalref
CODE
"[vandellon.thesis]gpss"
"ps-cur;
int crepsd(operator) int operator;
{ ps-cur->operator= ps-cur->code-link=
operator; mal loc(sizeof (CODE)
)
;
284
translation.
/+
NAME: ""
ps2tst
..
SYNOPSIS: "
ps2tst()
..
PURPOSE: *
Phase two test TEST
print
out
purposes
of
pseudo
generated.
code
only.
..
RETURNS: Not
applicable.
MAINTENANCE:
21-Mar-84
jvd
created
..
-/
^include
stdio
^include
"[vandel Ion
globalref
CODE CODE
globalref
int ps2tst(
"ps-root; *ps-cur;
)
{ CODE
*ps-work;
printf
("\n\n\n=====================");
printf
(
"\nPseudo Code
GeneratedXn")
;
printf("=====================\n\n"); ps-work=
f or( ;
ps-root;
ps-work
!=
ps-cur
;
ps-work=
ps-work->code-l
ink)
{ swi
tch(
ps-work-
>opera tor)
{ case(GENERATE): printf("\noperator:
GENERATE\nr
)
break; case(ASSIGN):
("Nnoperator:
ASSIGNNn");
("\nopera*or:
ADVANCEXn");
("\noperator:
DEPARTXn");
("\noperator:
ENTERNn");
("\noperator:
LEAVE\n");
printf("\noperator:
SEIZENn");
printf
break; case(ADVANCE): printf
break; case(DEPART): printf
break; case(ENTER): printf
break; case(LEAVE): printf
break; case(SEIZE):
break; case(QUEUE): printf("\noperator:
QUEUEVn");
break; case(RELEASE):
printf
("Nnoperator:
RELEASEXn");
("\noperator:
BR\n");
break; case(BR):
printf
285
;
break; case(GATE): printf
("\noperator:
GATEXn");
("\noperator:
TEST\n");
break; case(TEST): printf
break; case(TERMINATE): printf
("Xnoperator:
TERMINATED")
("\noperator:
BNE\n");
("\noperator:
BE\n");
("\noperator:
EQ\n");
("\noperator:
GT\n");
(
"\noperator:
LT\n");
(
"Xnoperator:
U\n");
(
"\noperator:
NU\n");
("Xnoperator:
SFXn");
(
"Xnoperator:
SEXn");
(
"Xnoperator:
SNFXn");
(
"Xnoperator-
SNEXn");
(
"Xnoperator:
NEGXn");
;
break; case(BNE): printf
break; case(BE): printf
break; case(EQ): printf
break; case(GT): printf
break; case(LT)
:
printf
break; case(U)
:
printf
break; case(NU): printf
break; case(SF)
:
printf
break; case(SE): printf
break; case(SNF):
printf
break; case(SNE): printf
break; case(NEG): printf
break;
} "block number = if (ps-work->A-operand
printf
(
%dXn"
,ps-work->block)
!=
;
NULL)
printf ("A-operand=
%s\n" ,ps-work->A-operand->label
)
;
)
;
else printf("A-operand=
if (ps-work->B-operand
!=
NULL *Xn");
NULL)
printf ("B-operand=
%s\n"
ps-work,
>B-ope rand- > label
else printf ("B-operand=
NULL *\n");
}
286
12.3. Simulator
and
Tools Program Listings.
NOTE
The
following
pages
capabilities of the
the
representation
are
the
hardware, for the
an
program
Due to printing listings for the thesis project. character is is an undefined character. The *
underscore
underscore.
287
/*+
NAME: gps-sim
SYNOPSIS: *
int gps-sim( root)
.*
*
PURPOSE:
*
Main
*
code
*
the
routine for simulation phase of the compiler. Pseudo has been generated, and we have to use that to create future and current events chain in the simulation.
** *
RETURNS:
Nothing **
MAINTENANCE:
.
29-Mar-84
jvd
created
-/
^include
stdio
^include ^include
"
global ref
global ref
CODE CODE int int
global ref
INFO-STRT strt[];
globaldef
*blk-stats= 0; BLOCK *stor-stats= STOR 0; ptr-que= QUE-STATS 0; fac-stats= ( FAC-STATS FUT-EVENTS *ptr-fut= 0 CUR-EVENTS *ptr-cur= 0 CUR-EVENTS *end-cur= 0 abs-clock= int 0; snap-interval= int snap-time= int 0;
[vandel Ion. thesis
"[vandel Ion
global ref
global ref
globaldef globaldef globaldef
globaldef globaldef
globaldef globaldef globaldef
globaldef
]gpss"
thesis]simulator" .
ps-cur; ps-root ; block-number strt-ptr;
/*
pointer
to
block
pointer
to
storage
/*
pointer
to
queue
/*
pointer
to
facility
/
pointer
to
future
/*
pointer
to
beginning
/
pointer
to
end
/
absolute
/*
/*
interval interval
snap snap
/
*/
statistics
*/
chain
*/
events of
current
current
/
*/
statistics
statistics
of
chain
events
/
chain
events
/
time
clock
pointer
statistics
print
(yes
print
out
no) /
or
*/
time
int gps-sim( root) SYM-TABLE 'root;
{ CODE CUR-EVENTS int CUR-EVENTS CUR-EVENTS CUR-EVENTS CUR-EVENTS CUR-EVENTS
*ps-work; *wrk-cur;
/
i
/
crstor(root)
;
sties
j
,
working working working
/
;
pointer
to
pseudo
pointer
to
current
variables
code
*/
events
chain
/
/
*simadv() simbne()
simter() *siment() "simsezi;) /
create
/*
outer
/
init
/
get
/*
loop
stati
storage
/
for(i=
number
0
of
i
;
code-l
ink
/*
)
loop
equal
t
ps-work->operator
==
GENERATE
)
/*
initial
generate
of
/
simgen(
root
} if(strt[i]->interval-print printout
+
/
statements
{
val
;
blocks /
(blk-stats
o
sizeof
/
,
ps-work, a bs-c lock) ;
!=
/*
0)
/
{ snap-interval=
YES;
288
check
for
snap
inter
snap-time*
strt[1]->interval-print; !=
while((strt[1]->s1m-time A-operand /
0)
!=
&& (wrk-cur
ERROR))
/
loop
/*
put
!=
ERROR))/*
circulate
/*
should
print
/*
call
to START
equal
{ *ent
events
trns-f ut-cur(root) ; /
wrk-cur=
ptr-cur
while((wrk-cur
through
future
onto
curr
chain
current
events
chain
;
!=
NULL) && (strt[i]->sim-time
!=
&& (wrk-cur
0)
/
{ if ((snap-interval ??
==
/
YES)
&& (snap-time
0))
==
we
out
{ report( tout
)
;
report
for
prin
/ snap-time=
strt[i]->interval
-print;
/
reinit
snap time /
} swi
erator
tch( wrk-cur ->cur-bl ock->code-link->operator)
*/
{ case(ADVANCE): wrk-cur=
simadv(
root
,
wrk-cur) ;
break; case(ASSIGN):
simass(
root
,
wrk-cur)
;
break; case(BR)
:
simbr( break;
root
,
wrk-cur)
;
case(BNE): wrk-cur=
simbne(
root
,
wrk-cur) ;
break; case(DEPART):
simdep(
root
,
wrk-cur) ;
break; case(ENTER): wrk-cur=
siment(
root
,
wrk-cur) ;
break; case(EQ) case(LT) case(GT)
sim-compare( break; case(U)
root
,
wrk-cur) ;
:
case(NU):
sim-gate-fac( root, wrk-cur)
;
break; case(SF):
case(SE) : case(SNF)
:
case(SNE):
sim-gate-stor(
root
,
wrk-cur) ;
break; case( LEAVE): simlev(
root
,
wrk-cur) ;
break; case(NEG):
simneg(wrk-cur) break;
;
case(RELEASE): simrel
(wrk-cur)
break; case(QUEUE):
289
;
/
check
pseudo
code
op
simque(
root
,
wrk-cur) ;
break; case(SEIZE): wrk-cur=
simsez(
root
,wrk-cur)
;
break; case(TERMINATE): wrk-cur=
simter(wrk-cur, i
)
;
break;
} } } if(strt[i]->print **f
report
at
end
of
report()
run
==
/
PRT)
/
;
} }
290
check
for printing o
/+
NAME: ..
simadv
.
SYNOPSIS: *
CUR-EVENTS simadv( SYM-TABLE CUR-EVENTS
*
root
,
wrk-cur) root wrk-cur
PURPOSE:
Processes the ADVANCE statement. Puts the advance on the future events chain in a sorted order. Calculates the block departure time (BDT). Takes the transaction off the current
.. .*
..
events
chain.
*
RETURNS: 'New'
..
pointer
to
current
events
chain.
..
MAINTENANCE: 7-Apr-84
#include ^include ^include
stdio
global ref
BLOCK int
jvd
"[vandel Ion
created
]gpss"
thesis "[vandel Ion. thesis ] Simula
global ref
.
tor"
blk-stats; abs-clock;
CUR-EVENTS simadv( root wrk-cur) SYM-TABLE 'root; CUR-EVENTS wrk-cur; ,
{ CUR-EVENTS FUT-EVENTS float int (blk-stats
/*
*hold-ptr; -wrk-fut;
/
working working
pointer
to
the
pointer
to
the future
current
events
events
chain
*/ /
chain
simrnd(); evaopr(); +
wrk-cur->blk-f
rom)->cur-contents--
;
/
let
you
/
get
current
/
transfer
/
hold back
link
/
calculate
BDT
into ADVANCE
block / wrk-cur->cur-block=
ters
wrk-fut=
nts
wrk-cur->cur-block->code-l
pointer
wrk-cur; to future
wrk-fut->cur-block=
hold-ptr=
poin
get
back
on
current
eve
/ wrk-cur->cur-block;
wrk-cur->bck-l
ink;
er / if (wrk-cur- >cur-block->A-ope *1
ink;
into ADVANCE /
rand-
>attr-pnt-> lab-attribute
SNA-PARAM)
point
arriva
/
chain
wrk-fut->BDT=
abs-clock
+
wrk-f ut->param[evaopr(wrk-cur->cur-block->A-operand
wrk-fut->BDT=
abs-clock
+
evaopr(wrk-cur->cur-block->A-operand
,
root)
-
1];
else
wrk-fut->blk-f
rom=
wrk-f ut->cur-block->block ;
nee you (blk-stats + wrk-fut->cur-block->block)->cur-contents++; *cs -up-to-date / (blk-stats + wrk-fut->cur-block->block)->total++; came
he
root)
; /
store
/
get
/
remove
/*
put
block from
whe
/
remcur(wrk-cur) om the
,
current
;
events
chain
srtfut(wrk-fut) ; sorted future events
current
statisti
transactio fr
/
chain
/
return(hold-ptr) ;
291
transaction
on
t
/+
NAME: .*
simass
..
**
SYNOPSIS:
**
int
** **
simass( root wrk-cur) SYM-TABLE "root CUR-EVENTS wrk-cur ,
** **
PURPOSE:
..
Processes the ASSIGN statement. into the proper parameter.
..
Puts the
of
value
the
assign
..
RETURNS:
Nothing .*
**
MAINTENANCE 10-Apr-84
jvd
created
.. -/
^include #incl ude
stdio
^include
"[vandellon.thesis]simulator"
global ref
BLOCK
"[vandellon. thesis
]gpss"
"blk-stats;
int simass( root wrk-cur) SYM-TABLE 'root; CUR-EVENTS wrk-cur; ,
{ int
evaopr();
(blk-stats block /
+
wrk-cur->blk-f
wrk-cur->cur-block=
ters
rom)->cur-contents--
wrk-cur->cur-block->code-l
;
ink;
associated
parameter
you
/
get
current
/*
assign
/*
store
into ASSIGN get
poin
,
root)
-
1)]
you
came
(blk-stats up-to-date
(blk-stats
rom=
+
proper
value
/
(wrk-cur->cur-block->B-operand->attr-pnt->pnt-info) wrk-cur->blk-f
nee
let
into ASSIGN /
wrk-cur->param[(evaopr(wrk-cur->cur-block->A-operand
"to
/
wrk-cur-
>cur-block->block;
;
block from
whe
/ +
wrk-cur->cur-block->block)->cur-contents++;
/ +
wrk-cur->cur-block->block)->total++;
}
292
/
get
block
statistics
NAME: simbne *
SYNOPSIS:
*
CUR-EVENTS s1mbne( SYM-TABLE CUR-EVENTS
root
,
wrk-cur) 'root
*wrk-cur;
*
PURPOSE: *
Processes the BNE statement. The BNE is used in both the TEST the GATE statement. This function processes the truth-bit and will not allow you into the block if no label.
*
and
** ** *
RETURNS:
**
NULL
if at end
*
CUR-EVENTS
next
of
current event
working
*
events
chain
the events
on
chain
MAINTENANCE: 16-Apr-84
jvd
created
^include
stdio
^include
"[vandellon.thesis]gpss"
#include
"[ vande 11 on.
global ref
BLOCK CODE
global ref
thesis ]
simulator"
blk-stats; ps-root;
CUR-EVENTS simbne( root wrk-cur) SYM-TABLE root; CUR-EVENTS *wrk-cur; ,
{ SYM-TABLE int int CODE CODE
*ret-status;
/
i ;
/
blk-from;
/
*wrk-pseudo:
/
*hld-pseudo;
/
wrk-cur->cur-block=
pointer
to
working
variable
holder from
holder for
wrk-cur->cur-block->code-l
SEARCH
/
/
block from
pseudo
working
table
symbol
code
to
pointer
whence
pointer
you
came
pseudo
/
code
/
ink;
seudo code / bl k-f rom= wrk-cur->cur-block->block;
ence
you
for later
came
if(wrk-cur->truth-bit
**s
before
statement
true
use
==
/
(blk-stats
to
pointer
get
storre
BNE p
block form
wh
/
YES)
/
if
/
let
/
add
/
both current
/
get
current
/
get
label
bit
says
ye
you
into
next
bl
the
trans
truth
/
{ ock
/
/
rom)->cur-contents--
+
wrk-cur->blk-f
+
wrk-cur->cur-block->block)->cur-contents++;
;
/
(blk-stats lock
statistics
(blk-stats *al
numbers
om
whence
into b
/ +
wrk-cur->cur-block->block)->total++;
and
tot
*/
wrk-cur->bl
k-f
came
you
rom=
blk-from;
block fr
/
return(wrk-cur) ;
} else
ret-status=
mbol
table
strlab(root
,wrk-cur->cu
hld-pseudo=
block
lock *al
ock-
>A-operand-> label
.SEARCH)
ret-status->attr-pnt->pnt-info;
do code for later / if (wrk-cur->cur-block->block
*E'
r-bl
;
,
SEARCH sy
*/
!=
/
hold
/
let
you
into
add
the
trans
address
of
pseu
hld-pseudo->block) rom)->cur-contents--
(blk-stats
+
wrk-cur->blk-f
(blk-stats
+
wrk-cur->cur-block->block)->cur-contents++;
/ (blk-stats
+
wrk-cur->cur-block->block)->total++;
>bl k-f
wrk-cu r->cu r-bl
;
'COMPAR
/ /
into b
statistics
numbers
/
wrk-cur-
for(i=
0.
rom=
wrk-pseudo=
ps-root
wrk-pseudo->block
!=
ock-
>bl
ock ;
;
(hld-pseudo->block
293
-
1)
;
/
both
current
and
tot
wrk-pseudo=
e
label
wrk-pseudo->code-l
ink, i++) /
find
statement
/
make
sure
befor
/
if(wrk-pseudo->block
==
wrk-pseudo->code-l
**le block /
ink->block)
wrk-cur->cur-block=
wrk-pseudo->code-l
wrk-cur->cur-block=
wrk-pseudo;
a
doub
get
poin
not
ink;
else
ters into COMPARE / return(wrk-cur->bck-link);
}
294
/
get
current
/+
NAME: simbr
SYNOPSIS: int
simbr( root wrk-cur) SYM-TABLE CUR-EVENTS ,
"root
"wrk-cur;
PURPOSE: .
Processes the BR
..
to an
The BR statement TRANSFER for version 1.
is
statement.
unconditional
equivalent
RETURNS:
Nothing
. .
MAINTENANCE: ..
7-Apr-84
jvd
created
..
-/
^include ^include ^include
stdio
global ref
BLOCK CODE
"[vandellon. "[vandel Ion.
global ref
thesis]gpss"
thesis]simulator"
blk-stats; ps-root;
int simbr( root wrk-cur) SYM-TABLE "root; CUR-EVENTS "wrk-cur; ,
{ SYM-TABLE int int CODE CODE (blk-stats block /
+
pseudo
whence
/ / /
holder
working
value
from
value
symbol
from block from pseudo
holder for
table
SEARCH /
/ code
pseudo
code
we
whence
pointer
came
wrk-cur->cur-block->code-l
pointer
/
ink;
came
(blk-stats numbers
+
/
get
pointer
/*
ock;
wrk-cur->cur-block->b1ock)->total++;
strlab(
value
into BRANCH into BRA
the
store
block from
/*
add
/
both
/
look for
/
retain
the
trans
current
into b and
tot
root
wrk-cur,
> cur-bloc k-> B-operand- > label
.SEARCH)
;
branching
1
ret-status->attr-pnt->pnt-info;
this
symbol
t
/
for(i= 0, do->code-link,
wrk-pseudo=
ps-root
;
wrk-pseudo->block
!=
(hld-pseudo->block
i++)
-
1)
; /
; '
you
/
hld-pseudo=
able
let
/
ret-status=
abel
/
/
(blk-stats + wrk-cur->cur-block->block)->cur-contents++; lock statistics / al
/
/
rom)->cur-contents--;
w rk-cur->cu r-bl ock->bl
you
return
working
/
code
bl k-f rom= *
/
wrk-cur->blk-f
wrk-cur->cur-block=
**NCH
/*
ret-status ; i ; bl k-f rom; wrk-pseudo ; hld-pseudo ;
ore the label to be branched to / if (wrk-pseudo->block == wrk-pseudo->code-l a double block /
/
ink->block)
wrk-cur->cur-block=
wrk-pseudo->cur-block->code-l
wrk-cur->cur-block=
wrk-pseudo;
wrk-pseudo=
search
make
wrk-pseu
for block bef
sure
it
is
not
ink;
el se
*
to
just before
label
wrk-cur->blk-f rom=
"whence
you
came
to branch
to
/"
get
current
/
put
into block from
pointers
*/
blk-from;
*/
}
295
/*+ *
NAME:
**
simcmp
** ..
SYNOPSIS int sim-compare( root SYM-TABLE CUR-EVENTS
** ..
.wrk-cur)
"root "wrk-cur
**
PURPOSE: Processes the EQ,
LT,
the
statement
truth
that
of
GT statement. This and if it is true
and
process sets
tests
for
the
truth-bit *
RETURNS:
.*
Nothing.
*. ** *
MAINTENANCE: 13-Apr-84
jvd
created
**
/ ^include #incl ude
stdio
#incl
"[vandellon
"[vandellon
ude
BLOCK
globalref
int
.
thesis
]gpss"
'blk-stats;
sim-compare( root ,wrk-cur) SYM-TABLE "root; CUR-EVENTS "wrk-cur;
{ int int int
evaopr(
)
if (wrk-cur->b.l k-f rom
(blk-stats block /
**E'
+
into COMPARE
A-operator=
working A-operand working B-operand
/
evaluation
*/
evaluation
*/
; !=
wrk-cur->cur-block->block)
wrk-cur->bl
wrk-cur->cur-block=
"ters
/*
A-operator; B-operator;
k-f
rom)->cur-contents--
/
;
/
wrk-cur->cur-block->code-link;
into
let
you
get
current
'COMPAR get
poin
/
evaop r(wrk-cur->cu
r-bl
ock-
>A-ope rand
,
root) ;
/
evaluate
A-operand
/*
evaluate
B-operand
*
/
check
for equality
o
YES /
/
if (wrk-cur- >cu r-bl A-operator=
B-operator=
>A-operand->attr-pnt-> lab-attribute
wrk-cur->param[ A-operator
-
B-operator=
ock-
,
root) ;
>B-ope rand- >attr-pnt-> lab-attribute
==
==
SNA-PARAM)
1];
wrk-cur->param[B-operator
if (wrk-cur->cur-block->operator A & B /
SNA-PARAM)
1];
evaop r(wrk-cur->cur-block-> B-operand
if (wrk-cur->cu r-bl
*f
ock-
EQ)
{ if (A-operator
==
B-operator)
wrk-cur->truth-bi t=
YES;
/
equal
wrk-cur->truth-bi t=
NO;
/
NOT
else
} if (wrk-cur->cur-block->operator
else
*n
B
==
LT)
/
equal
check
/
for A less
the
/
{ if (A-operator
truth-bit=
YES;
/
less than YES /
wrk-cur->truth-bi t=
NO;
/
NOT less
else
if(wrk-cur->cur-block->operator
else
than
==
GT)
/
check
than
for A
/
greater
B / if (A-operator >
/*
B-operator)
wrk-cur->truth-bi t=
YES;
wrk-cur->truth-bi t=
NO;
else
}
296
greater
than
YES */
/+
NAME: *
simdep
..
SYNOPSIS: *
int
.*
simdep( root wrk-cur) SYM-TABLE 'root CUR-EVENTS *wrk-cur ,
..
PURPOSE: .
Processes the DEPART statement. The transaction leaves it had entered in a previous QUEUE block
..
a
queue
which
.
RETURNS: *
Nothing
..
*
MAINTENANCE: 14-Apr-84
jvd
created
.*
#include ^include ^include
stdlo
global ref
BLOCK int
"[vandellon thesis]gpss" "[vandellon. thesis ]simu la .
global ref
tor"
blk-stats; abs-clock;
int simdep( root wrk-cur) SYM-TABLE 'root; CUR-EVENTS *wrk-cur; ,
{ int int
/
hold;
(blk-stats block
/
+
wrk-cur->blk-f
rom)->cur-contents--
;
/
let
you
/*
get
current
/
check
/
depart default
into DEPART
/ wrk-cur-
wrk-cur->cur-block=
ters
variable
working
evaopr();
>cur-block->code-l
ink;
poin
get
into DEPART /
if (wrk-cur->time-que from queue / wrk-cur-
==
abs-clock)
for
zero
entry
>ptr-que->zero-ent++;
else wrk-cur->ptr-que->cum-time
(abs-clock
+
if (wrk-cur->cur-block->B-operand
wrk-cur->time-que)
;
NULL)
==
1
of
/ hold=
1;
if (wrk-cur->cur-block->B-operand->attr-pnt->lab-attribute
else
hold=
wrk-cur->param[(evaopr(wrk-cur->cur-block->B-operand,
hold=
evaop
==
SNA-PARAM)
root)
-
1)];
/
evaluate
B-operand
else r(wrk-cur->cu r-bl
wrk-cur->ptr-que->cur-contents
rent contents wrk-cur->bl
'nee
you
came
(blk-stats o-date / (blk-stats
by B-operand k-f
rom=
-
ock-
=
>B-ope rand, root) ; /*
hold;
decrement queues
cur
block from
whe
/
wrk-cur-
>cu
r-bl ock->bl
ock;
/
store
/ +
wrk-cur->cur-block->block)->cur-contents++;
+
wrk-cur->cur-block->block)->total++;
}
297
/
get
block
stats
up-t
/+
NAME: a.
siment
*
SYNOPSIS: *
CUR-EVENTS *siment( SYM-TABLE CUR-EVENTS
.. *.
root
,
wrk-cur) *root 'wrk-cur
*
PURPOSE: ..
Processes the ENTER statement. storage from the storage unit
*.
Lets
transaction
a
take
some
specified.
.* *
RETURNS: 'NEW'
.*
current
events
chain
pointer.
*
*
MAINTENANCE: 13-Apr-84
jvd
^include ^include ^include
stdio
globalref
BLOCK int
created
"[vandellon lon.thesis]simulator" "[vandel
globalref
'blk-stats; abs-clock;
CUR-EVENTS *siment( root wrk-cur) SYM-TABLE 'root; CUR-EVENTS "wrk-cur; ,
ge
SYM-TABLE int int int
ret-status
/*
hold;
/
char
stor-label
evaopr(
)
/*
NO
no-room=
pointer
to
working
variable
table
symbol
entry SEARCH /
/
block transaction
from entering
/
storage
label's
name
no
/
storage
/
if (wrk-cur->cur-block->code-l ink->A-operand->attr-pnt->lab-attribute label / ret-status=
if
;
==
LAB-STOR)/*
/
wrk-cur->cur-block->code-link->A-operand;
if
for
check
so
no
need
stora
to do
search / else
{ stor-label=
*
evasto(
root
,wrk-cur->cu
r-bl
ock-
>code-l i
nk-
> A-ope rand, wrk-cur->cur-block-> code- 1
ink)
.
if((ret-status=
ation
for
storage
strlab(
root
.stor-label
.SEARCH)
)
/
ERROR)
==
{ printf
("XnBlock %d\tAbsolute Clock
table
symbol
loc
%d\n" ,wrk-cur->cur-block->block
return(error(STR-NOT-FND)) ; program
get
/
,
abs-clock)
;
/
storage
undefined
in
/
if B NULL default
is
/
check
/
if
for room / decrement
co
*/
} } if (wrk-cur->cur-block->code-l ink->B-operand
1
==
NULL)
/
{ if(ret-status->attr-pnt->func-spec '
( unt
>=
1)
re t-status->attr-pnt->f unc-spec)--;
room
/ else no-room=
YES;
} else
hold=
evaop r(wrk-cur->cu r-bl
ock-
/
>code-link->B-ope rand, root) ;
evaluate
B-operand
*/
if (wrk-cur- >cur-block->code-l
ink-
>B-operand->attr-pnt->lab-attribute
if (ret-status->attr-pnt->func-spec
>=
wrk-cur->param[hold] ) wrk-cur->param[hold]
ret-status->attr-pnt->func-spec
rement
*/ else no-room=
YES;
} 298
==
-
SNA-PARAM) /
;
is
there /
room yes
? /
room
dec
else
{ tal
storage
if (ret-status->attr-pnt->func-spec /
>=
hold)
/
if
/
if there
/
let
you
/
get
current
/
find
storage
/
fill
in
/
cumulative
room
decrement to
count
ret-status->attr-pnt->func-spec
-
-
hold;
'
el se no-room=
YES;
} } if(no-room
==
NO)
is
/
room
{ (blk-stats lock
/
ters
into ENTER
+
wrk-cur->blk-f
wrk-cur->cur-block=
area
wrk-cur-
>cur-block->code-l ink;
ENTER b
into
get
poin
/
wrk-cur->ptr-stor=
ics
rom)->cur-contents--;
fndstr(
ret-status->label
)
;
statist
/
wrk-cur->time-stor=
abs-clock;
information
/
if(ret-status->attr-pnt->lab-attribute
==
SNA-PARAM)
{ wrk-cur->ptr-stor->cum-contents
+
-
wrk-cur->param[hold] ;
contents
/ wrk-cur->ptr-stor->cur-cont
+
-
wrk-cur->param[hold] ;
/
current
/
total
entries
/*
check
for
/
store
block from
contents
/
} else
{ wrk-cur->pt r-stor->cum-contents
wrk-cur->ptr-stor->cur-cont
+
-
hold; hold;
+
-
} wrk-cur->ptr-stor->ent
ries++;
if (wrk-cur->ptr-stor->cur-cont > wrk-cur->ptr-stor->max-cont) ntents / wrk-cur->ptr-stor->max-cont=
wrk-cur->bl
nee
you
came
rom=
wrk-cur->ptr-stor->cur-cont
wrk-cur->cur-block->block ;
co
; whe
/.
(blk-stats up-to-date
k-f
/
maximum
+
wrk-cur->cur-block->block)->cur-contents++;
?
wrk-cur->cur-block->block)->total++;
/
(blk-stats
return(wrk-cur) ;
} else return(wrk-cur->bck-l
ink)
;
}
299
/*
get
block
statistics
*
NAME:
*
simf ac
**
SYNOPSIS:
**
int
sim-gate-fac(
**
root, wrk-cur)
SYM-TABLE CUR-EVENTS
*
*root 'wrk-cur
** **
PURPOSE:
*
Processes the U,
**
the
**
truth-bit
truth
of
and
that
NU
This if it is
statement.
statement
and
process
true
tests
sets
for
the
**
RETURNS: *.
Nothing
.
*. *
*.
MAINTENANCE: 15-Apr-84
jvd
created
. -/
tfincl #incl
ude
stdio
ude
"[vandel
#include int
lon.thesis]gpss"
"[vandellon. t he sis]simu la
tor"
sim-gate-fac( root wrk-cur) SYM-TABLE 'root; CUR-EVENTS 'wrk-cur; ,
{ int int FAC-STATS int
into U
/*
/
working working
variable
pointer
to
variable
for A-operand for B-operand
facility
stats
evaluation
*/
evaluation
/
/
evaopr();
wrk-cur->cur-block=
ters
/*
A-operator; B-operator; 'ptr-fac;
or
A-operator=
wrk-cur->cur-block->code-l
ink;
/*
get
/
evaluate
/
find
/
is
/
facility
is
/
facility
not
/
is facil
ity
not
SEIZ
/*
facility
is
not
seiz
/
facility
is
seized
current
get
poin
NU block / evaop r(wrk-cur->cur-block->A-ope rand
,
root)
;
A-operand
/
if
( wrk-cur->cu r-bl A-operator=
ptr-fac=
ock-
>A-ope
rand
->attr-pnt->
wrk-cur->param[ A-operator
lab-attribute
f ndf ac(A-operator) ;
/ if (wrk-cur->cur-block->operator
==
SNA-PARAM)
1]; associated
faci
lity
==
U)
facilty
SEIZED ?
/
{ if(ptr-fac->seized
==
YES)
seized
/ wrk-cur->truth-bit=
YES;
else
seized
/ wrk-cur->truth-bit=
NO;
} if (wrk-cur->cur-block->operator
else
ED
==
NU)
/
{ if (ptr-fac->seized **ed
==
NO)
*/ wrk-cur->truth-bit=
YES;
else
/ wrk-cur->truth-bi t=
NO;
300
*
/+ ..
NAME: sim-gate-stor
..
*
SYNOPSIS
*
int sim-gate-stor( root wrk-cur) SYM-TABLE 'root *wrk-cur CUR-EVENTS ,
.. .*
*
PURPOSE:
Processes the SE, SF, SNE, and SNF statement. This process for the truth of that statement and if it is true sets
tests the
truth-bit
RETURNS: ..
Nothing
.
..
*
MAINTENANCE: 16-Apr-84
jvd
created
..
-/
^include ^include ^include int
stdio thesis]gpss"
"[vandel Ion "[vandellon. t he sis]simu la .
tor"
sim-gate-stor( root .wrk-cur) SYM-TABLE 'root; CUR-EVENTS "wrk-cur;
{ SYM-TABLE STOR
"ret-status; "ptr-stor; "stor-label;
char
wrk-cur->cur-bl
ters
o
into SE,
SF,
ock=
SNE,
/
pointer
to
storage
symbol
/
pointer
to
storage
stats
/
pointer
to
ascii
wrk-cur->cur-block->code-l or
SNF
label
/
table entry /
for storage
/ /
ink;
current
get
get
poin
/
if (wrk-cur->cur-block->A-operand->attr-pnt->lab-attribute to find /
==
LAB-STOR)
/
if
storage
n
already
need
{ ret-status= stor-label=
w rk-cur->cu r-bl ock->A-ope
rand;
ret-status->label ;
} else stor-label=
from
symbol
table
if((ret-status=
evasto(root
,wrk-cur->cur-block->A-operand,wrk-cur->cur-block)
/
;
get
storage
*/
strlab(
root
,stor-l?bel
==
.SEARCH))
return(error(STR-NOT-FND));
ERROR) /*
storage
/
find
/*
storage
full?? /
/
storage
empty ?? /
/
storage
not
full
/
storage
not
empty ??
undefined
*/
** ptr-stor=
sociated
to
fndstr(ret-status->label trans
)
;
storage
area
as
/
if (wrk-cur->cur-block->operator
==
SF)
{ if (ptr-stor->cur-cont
==
ptr-stor->capacity
wrk-cur->truth-bit=
YES;
wrk-cur->truth-bit=
NO;
)
else
} if(wrk-cur->cur-block->operator
else
==
SE)
==
SNF)
{ if (ptr-stor->cur-cont
==
0)
wrk-cur->truth-bit=
YES;
wrk-cur->truth-bit=
NO;
else
else
if(wrk-cur->cur-block->operator
??
/ if (ptr-stor->cur-cont
capadty)
wrk-cur->truth-bit=
YES;
wrk-cur->truth-bit=
NO;
else
else
if (wrk-cur->cur-block->operator
==
SNE)
'301
/
{ if (ptr-stor->cur-cont >
0)
wrk-cur->truth-bit=
YES;
wrk-cur->truth-bit=
NO;
else
}
302
/*+ *
NAME: simgen
**
SYNOPSIS: int
simgen(root, ps-work, clock) SYM-TABLE root CODE *ps-work int clock
** **
PURPOSE:
*
Processes the GENERATE future events chain in departure time (BDT).
**
**
Puts
statement. a
sorted
the generate on the Calculates the block
order.
RETURNS:
*
Nothing
.
*
MAINTENANCE: 29-Mar-84
jvd
created
..
-/
#include
stdio
^include ^include
"[vandellon. "[vandellon.
thesis]gpss"
thesis]simulator"
int simgen( root ps-work, clock) SYM-TABLE 'root'; CODE ps-work; int clock; ,
FUT-EVENTS int int int float float int wrk-f
uture
ut=
wrk-f
/*
i ; A-val ue;
/
B-value;
/
/
/
temp-f 1 t ;
simrnd( evaopr(
mal
chain
wrk-f ut ;
) )
working working
pointer
holding holding
value
holder
events
chain
/
/
for A-operand / for B-operand */
value
for
future
to
variable
floating
calculation
/
; ; /
loc(sizeof( FUT-EVENTS));
allocate
for f
space
/
entry
ut->cur-block=
ps-work;
/
point
/*
init
/*
calculate
/
evaluate
A-operand
/
evaluate
B-operand f
/
round
kludge,
to
pseudo
code
/ for(i=
0
;
i
B-operand rture time / wrk-fut->BDT=
parameters
/
0;
wrk-fut->param[i]=
NULL)
==
clock
+
evaopr(ps-work->A-operand
,
root
)
block depa
;
else
{ A-val
ue=
evaopr(ps-work->A-operand
,
root)
;
B-value=
evaopr(ps-work->B-operand
,
root)
;
ield
/
ield
/
get
if (ps-work->B-operand->attr-pnt->lab-attribute random distribution /
==
CONSTANT)
of
f
to
even
{ temp-flt=
(B-value
if(simrnd()
>
temp-fit wrk-fut->BDT=
+
simrnd())
.5;
.5)
-1.
-
;
clock
+
A-value
clock
+
(A-value
+
(
int)temp-f 1 t ;
} else wrk-fut->BDT=
STANT
then
it
is
multiplication
time
B-value);
/
if B-operand
non-CON
/
} wrk-fut->blk-f rom=
*nce
you
came
/*
ps-work->block;
/
srtfut(wrk-fut);
""the
sorted
store
block from
whe
*/
future
events
chain
/
303
put
new
entry
on
to
/*+ *
NAME:
**
simlev
* **
SYNOPSIS:
**
int
** *
simlev( root wrk-cur) SYM-TABLE "root CUR-EVENTS "wrk-cur ,
* *
PURPOSE:
**
Processes the LEAVE statement. storage from the storage unit
Lets
a
transaction
give
back
specified.
** **
RETURNS:
Nothing **
MAINTENANCE: 13-Apr-84
jvd
created
* -/
#include
stdio
^include ^include
"[vandellon.thesis]gpss"
global ref
BLOCK int
"[vandel Ion
global ref
thesis]simulator" .
"blk-stats; abs-clock;
int simlev( root wrk-cur) SYM-TABLE "root; CUR-EVENTS "wrk-cur; ,
{ SYM-TABLE int int
"ret-status;
/
hold;
/
evaopr(); *stor-label ;
char
(blk-stats lock /
+
wrk-cur->blk-f
wrk-cur->cur-block=
into
ters
*o
LEAVE
symbol
variable
/
ascii
ock-
> code- 1
pointer
/
/
label,
storage
rom)->cur-contents--
w rk-cu r->cu r-bl
table
storage
working
name
*/ /
;
/"
ink;
into LEAVE b
let
you
get
current
get
poin
/
if (wrk-cur->cur-block->A-operand->attr-pnt->lab-attribute necessary /
==
/
LAB-STOR)
if already
storage
n
search
ret-status=
w rk-cu r->cu r-bl
ock-
>A-ope rand ;
else
{ wrk-cur-
= evasto( root if ((ret-status= strlab( root,
stor-label
,
ock-> A-operand
>cu r-bl
stor-label
==
.SEARCH))
{ printf
*ned
)
>cu r-bl ock) ;
%d\n"
("XnBlock %dXtAbsolute Clock
return(error(STR-NOT-FND)
wrk-cur,
ERROR)
,wrk-cur->cur-block->block
/
;
,
abs-clock)
;
error
storage
undefi
leave
storage
with
*/
} } if (wrk-cur->cur-block->B-operand of 1 /
==
/
NULL)
d
efault
(ret-status->attr-pnt->f unc-spec '
)++;
else
hold=
evaopr(wrk-cur->cur-block->B-operand,
root)
/
;
evaluate
B-operand
/
if (wrk-cur->cur-block->B-operand->attr-pnt->lab-attribute into
storage
area
==
SNA-PARAM)
/ -
ret-status->attr-pnt->func-spec wrk-cur->ptr-stor->cur-cont
-
-
+ wrk-cur->param[hold] wrk-cur->param[hold] ;
} else
ret-status->attr-pnt->func-spec wrk-cur->ptr-stor->cur-cont
-
=
hold; hold;
+
-
} } 304
;
.
/
put
statistical
info
'
w rk-cu r->bl
nee
you
came
(blk-stats o-date
k-f rom= wrk-cur->cur-block->block; */
/
store
+
wrk-cur->cur-block->block)->cur-contents++;
/*
get
+
wrk-cur->cur-block->block)->total++; /
reinit
block
stats
whe
up-t
/
(blk-stats
wrk-cur->ptr-stor->cum-tm
s
block from
pointer
to
storage
wrk-cur->time-stor=
+
=
(abs-clock
-
wrk-cur->time-stor) ;
/
0;
}
305
current
event
/+
NAME: *
simneg SYNOPSIS:
int simneg(wrk-cur) CUR-EVENTS
wrk-cur
** *
PURPOSE:
Processes and
the NEG
statement.
that value
puts
into
a
Negates
the
value
of
an
ASSIGN
temporary location.
RETURNS: * *
Nothing
.
* *
*
MAINTENANCE: 10-Apr-84
jvd
created
/
^include # include
stdio
^include
"[vandel Ion "[vandellon
globalref
BLOCK
thesis]gpss" .
.
thesi sjsimu la
tor"
*blk-stats;
int simneg(wrk-cur) CUR-EVENTS *wrk-cur;
{ FUT-EVENTS
*wrk-fut;
(blk-stats block
wrk-cur->cur-block->block)->cur-contents--
+
to i
atoi negate
future
events
chain
;
wrk-cur->cur-block->code-l
ink;
+
/
/
let
you
/
get
current
/*
add
to
block
stats
c
/
add
to
block
stats
t
into NEGATE get
poin
contents
+
+
;
*/
wrk-fut->cur-block->block)->cur-contents++;
*/
contents
(blk-stats
(wrk-cur->cur-block->A-operand->attr-pnt->pnt-info)]
(wrk-cur->cur-block->B-operand->attr-pnt->pnt-inf o)
parameter
(blk-stats urrent **otal
to
into NEGATE /
w rk-cu r->param[a
/*
pointer
working
/
wrk-cur->cur-block=
ters
/
wrk-fut->cur-block->block)->total++;
*/
}
306
/+
NAME: simque
SYNOPSIS: *
1nt simque( root wrk-cur) SYM-TABLE "root CUR-EVENTS *wrk-cur ,
*
PURPOSE:
Processes the QUEUE statement. The transaction from the previous block and entered in a queue
1s
accepted
..
RETURNS: ..
Nothing MAINTENANCE: 14-Apr-84
jvd
created
-/
^include
stdio
^include
"[vandel 1 on.
thesis]gpss"
^include
"[vandellon.
thesis]simulator"
global ref
BLOCK int
global ref
int simque( root SYM-TABLE CUR-EVENTS
blk-stats; abs-clock;
,wrk-cur)
'root; *wrk-cur;
{ int int int
/
hold;
/
integer
queue
working
variable
name
/
/
evaopr();
(blk-stats lock
queue-name;
+
wrk-cur->blk-f
rom)->cur-contents--
;
/
let
you
/
get
current
into QUEUE b
/
wrk-cur->cur-block=
wrk-cur->cur-block->code-l
ink;
poin
get
into QUEUE*/
ters
if (
wrk-cur-
>cu r-bl
ock-
>A-operand->attr-pnt-> lab-attribute
==
/
SNA-PARAM)
queue-name=
wrk-cur->param[evaopr(wrk-cur->cur-block->A-operand
queue-name=
evaopr(wrk-cur->cur-block->A-operand) f ndque(queue-name) ;
,
root)
-
evaluate
queue
name
1];
else ;
find
wrk-cur->ptr-que=
s
wrk-cur->time-que=
ue
statistic
store
abs-clock; /
if (wrk-cur->cur-block->B-operand
is
==
NULL)
{ contents
/
if B-operand NULL de
r-
>p t r-que->cur-con tent s++;
/
add
/
evaluate
B-operand
/
increase
current
/*
increase
cumulative
/*
increase total
/
check
to
/
store
block
to
curren
queues
/
hold=
1;
if (wrk-cur->cur-block->B-operand->attr-pnt->lab-attribute
else
que
1 /
w rk-cu
'
entry into
transaction
current
with
fault
**t
queue
block /
hold=
wrk-cur->param[(evaopr(wrk-cur->cur-block->B-operand
hold=
evaop r(
==
,
SNA-PARAM)
root)
1)];
/ else wrk-cur-
>cu r-bl
ock->B-ope rand,
+
wrk-cur->ptr-que->cur-contents
root)
;
hold;
=
con
tents / wrk-cur->ptr-que->total-que
+
=
hold;
contents / w r k-cu r >ptr-que-> total -en t++; *es into queue */ if (wrk-cur->ptr-que->cur-con tents -
contents
up
to
date
nee
you
came
k-f
rom=
w rk-cu r->ptr-que->max-con
tent)
see
if
max
/
t= w rk-cu r->ptr-que->max-con ten
w r k-cu r->bl
>
entri
wr k-cu r->ptr-que-> cur-con tents ;
wrk-cur->cur-block->block;
/
307
from
whe
(blk-stats up-to-date
(blk-stats
+
wrk-cur->cur-block->block)->cur-contents++;
/ +
wrk-cur->cur-block->block)->total++;
}
308
/
get
block
statistics
/+
NAME: ..
simrel
..
SYNOPSIS: int simrel(wrk-cur) CUR-EVENTS
"wrk-cur
.*
PURPOSE:
Processes the RELEASE *"
Always
statement.
lets
a
transaction
enter.
RETURNS: *.
Nothing.
..
MAINTENANCE: 15-Apr-84
jvd
created
-/
^include
stdio
^include
"[vandellon.thesis]gpss"
^include
"[vandel 1 on. thesis]simu la
globalref
BLOCK int
globalref
int
simrel
tor"
"blk-stats; abs-clock;
(wrk-cur)
CUR-EVENTS
"wrk-cur;
{ (blk-stats block
+
wrk-cur->blk-f
wrk-cur->cur-block=
ters
/
let
you
/
get
current
into RELEASE
wrk-cur->cur-block->code-l
ink;
poin
get
into RELEASE /
wrk-cur->ptr-fac->seized=
wrk-cur->ptr-fac->cum-time
e
time
**e
you
came
+
=
(
abs-clock
-
wrk-cur->time-sez
);
/
release
facility
add
to
the
/
get
block
/
add
current
add
to
/
cumulativ
k-f
rom=
wrk-cur->cur-block->block;
from
whenc
/
(blk-stats block
/
NO;
*/
wrk-cur->bl
*s
rom)->cur-contents--;
/
+
wrk-cur->cur-block->block)->cur-contents++;
statistics
contents
/
(blk-stats + wrk-cur->cur-block->block)->total++; block statistics /
}
309
/
total
content
/+ *
NAME:
.
simsez
*
SYNOPSIS: **
CUR-EVENTS *simsez( SYM-TABLE CUR-EVENTS
* .
root
,
wrk-cur) 'root *wrk-cur
.*
PURPOSE: **
Processes the SEIZE statement. Lets a transaction enter a if the facility is not being utilized. Otherwise it returns a NULL to put the transaction back on the CURRENT EVENTS chain.
*.
facility
.. .. *
RETURNS: ..
NULL CUR-EVENTS
..
if putting the
current
transaction events
back
on
transaction
the
chain
just
worked
on
** *
MAINTENANCE:
15-Apr-84
jvd
created
-/
^include #include ^include
stdio
global ref
BLOCK int
thesis]gpss"
"[vandellon. "[vandellon. thesis ]simul
global ref
CUR-EVENTS
*simsez(
a
tor"
blk-stats; abs-clock;
root
,
wrk-cur)
SYM-TABLE CUR-EVENTS
*root; wrk-cur;
FAC-STATS
*wrk-fac; hold;
{ int int
/ /*
working working
pointer
to
variable
facility
statistics
/
/
evaopr();
hold=
evaop r(wrk-cur->cu r-bl
ock->code-l
/
ink-> A-operand, root) ;
evaluate
A-operand
/
if (wrk-cur- >cu r-bl hold= wrk-fac=
tics
>code-l ink->A-ope rand- >attr-pnt-> lab-attribute
1
wrk-cur->param[ hold f ndf ac(hold) ;
associated
with
if (wrk-fac->sei .?
ock-
zed
SNA-PARAM) /
find
/
is
facility
/*
if
not
/
get
current
set
seize
facil
ity
statis
/
trans
NO)
==
==
];
seized
?
SEIZE
b
./
{ (blk-stats
+
wrk-cur->blk-f
rom)->cur-contents--
;
enter
lock / wrk-cur->cur-block=
ters
wrk-f ac->seized=
o block
get
poin
/
within
trans
w rk-cu
r-
wrk-cur-
came
/
wrk-fac;
>p t r-f ac-> total -en t++;
/
entry time int
point
to
facility
st
>bl k-f rom=
w rk-cu r->cur-block->b
w rk-cu r->cur-block->bl
/
increment
/
store
/
get
stats
*/
lock;
ock;
block from
whe
/
(blk-stats
o-date
flag
store
/
wrk-cur->ptr-fac->seize-block=
you
/
abs-clock;
/
wrk-cur->ptr-fac=
nee
ink;
YES;
wrk-cur->time-sez=
ats
wrk-cur->cur-block->code-l
into SEIZE */
/ (blk-stats
+
wrk-cur->cur-block->block)->cur-contents++;
+
wrk-cur->cur-block->block)->total++;
return(wrk-cur) ;
} el se retu rn(wrk-cur->bck-l
ink)
;
}
310
block
stats
up-t
/+ *
NAME:
*
..
simter
SYNOPSIS:
CUR-EVENTS "simter (wrk-cur, cur-run) CUR-EVENTS "wrk-cur;
*
int
cur-run;
.*
*
PURPOSE:
.*
Processes the TERMINATE statement. Eliminates the transaction from the current events chain. Decrements the transaction termination count if the TERMINATE A-operand is not NULL. RETURNS: Return
link
next
the
n
CURRENT
EVENTS
chain.
MAINTENANCE: ..
7-Apr-84
jvd
created
..
-/
#include
stdio
^include
"[ vandel! on.
thesis]gpss"
^include
"[vandellon
thesis]simulator"
global ref
BLOCK INFO-STRT int int
global ref global ref global ref
.
blk-stats; strt[]; snap-interval ;
snap-time ;
CUR-EVENTS simter( wrk-cur, cur- run) CUR-EVENTS wrk-cur; int cur-run;
/
run
current
of
this
program
/
{ CUR-EVENTS
'hold-ptr;
(blk-stats minate
+
wrk-cur->blk-f
rom)->cur-contents--
;
/
you
are
/*
get
current
/
both
/
if
let
into ter
/
wrk-cur->cur-block=
wrk-cur->cur-block->code-l
ink;
block
-
TERMINATE /
(blk-stats **al
numbers
+
wrk-cur->cur-block->block)->total++;
if (wrk-cur->cur-block->A-operand ate
the
run
current
and
tot
/ !=
NULL)
isn't NULL termin
/
count
{ strt[cur-run]->sim-time
if (snap-interval
==
snap-time
-
-
(wrk-cur->cur-block->A-operand->attr-pnt->pnt-info)
YES) =
*(wrk-cur->cur-block->A-operand->attr-pnt->pnt-inf o) ;
} hold-ptr=
event
wrk-cur->bck-l
wrk-cur->bl
**e
you
/
ink;
go
onto
next
current
/ came
k-f
rom=
w rk-cu r->cur-block->b lock ;
/
get
block from
whenc
*/
remcur(wrk-cur) ; f ree(wrk-cur) ;
return(hold-ptr
)
/
;
311
free the
contents
/
/*+ **
NAME:
*.
report
.
*
SYNOPSIS: int
report()
*. *
PURPOSE:
Standard
output
the GPSS
of
simulation.
*.
RETURNS: ..
Not
applicable
*
MAINTENANCE: *.
28-Mar-84
jvd
created
** -/
^include #include #include
stdio
global
global ref
int int
global ref
BLOCK
global ref
STOR stor-stats ; QUE-STATS *ptr-que; FAC-STATS *fac-stats;
"[vandellon. thesis "[vandel Ion
ref.
global ref global ref
int
]gpss"
thesis]simulator"
.
abs-clock;
block-number; blk-stats;
report()
{ int
float STOR QUE-STATS FAC-STATS k=
/
wrk-que ; wrk-f ac ;
/
/ /
/
for
worker
for
variables
working working working working
floating
stats
storage queue
stats
facility
FOR
point
loops
pointer
/
/
pointer
/
pointer
stats
*/
arithmetic
/
0;
printf for(j=
ics
i, j. k; fit-hold; wrk-stor;
("XnXnAbsolute block-number ;
\t%d\n"
clock:
j
>
,
0
j=
;
abs-clock) ; /
j-30)
blocok
print
statist
]
*/
{ COUNTSXn"); ("BlockXtCurrent\tTotal\tBlock\tCurrentXtTota1XtBlockXtCurrent\tTotal\t\n")
printf("XnBLOCK
printf
;
printf("=====Xt=======Xt=====\t=====Xt=======\t=====\t=====\t=======\t=====\tXn");
for(i=
(i
i)
;
i++)
{
total
+
i)->total);
(blk-stats
k+
i
)->cur-contents, (blk-stats
k
i)->total
(i
+
k
+
1)
(i
+
k
+
11), (blk-stats
+
10
+
k
+
i )->cur-contents
,
(bl k-stats
+
10
+
k
(i
+
k
+
21), (blk-stats
+
20
+
k
+
i )->cur-contents
,
(bl k-stats
+
20
+
k
,
+
+
+
,
else
if (
(
i
+
10)
cur-contents (blk-stats + k + i)->total, (blk-stats + 10 + k + i )->cur-contents, 10 + k + i)->total);
k
+
+
,
6 1 SG printf("\n%5d\t%7d\t%5d",(i
(blk-stats
+
k
+
k
+
+
1)
,
(bl k-stats
+
k
+
i )->cur-contents
.
i)->total);
} k
30;
+
} if(fac-stats sties
if
!=
pointer
/
NULL) not
NULL
/
printf
("Xn\nFacilityXtAverage\t\tNumber\tAverage\t\tSeizing\n");
printf
("XtXtUtili
for(wrk-fac=
zationXtEntriesXtTime/TranXtTrans.
fac-stats
;
wrk-fac
!=
NULL
;
wrk-fac=
No.
\n")
;
wrk-f ac->l
ink)
f lt-hold= ( (fl oat) wrk-f ac->cum-time/(float)wrk-fac->total-e %9f\t%9d\n" wrk-f ac->name /.7d printf ("%8dXt%llf ,
312
,
print
facility
statin
(((float)wrk-fac->total-ent/(float)abs-clock)
fit-hold), + 1));
wrk-fac->total-ent, fit-hold, (wrk-fac->seize-block
} if(ptr-que pointer
not
!=
/
NULL)
NULL
print
queue
if
stats
*/
{ printf ("XnQueue prlntf
Maximum
("XtContents
for(wrk-que=
Average Total Zero Average CurrentXn"); Entries Entries Time/Trans ContentsXn") ; wrk-que != NULL ; wrk-que= wrk-que->l ink)
Contents
ptr-que
;
{ f1
t-hold=
((f loat)wrk-que->cum-time/(f 1 oat )wrk-que-> total -ent) ; %10f%8d\n" %8d %8f %5d %7d (((f loat)wrk-que->cum-contents/(f loat)abs-clock) * fit-hold),
printf("%5d
wrk-que->
,wrk-que->name
total -que,
wrk-que->zero-ent
wrk-que->cur-contents)
.fit-hold
,wrk-que->max-content
,
,
;
} } if
if ((stor-stats != NULL) && (stor-stats->entries there have been entries /
!=
/*
0))
print
{ printf
("XnStorage Average Entries Average Current Average Capacity Contents Utilization \t Time/Trans Contents ContentsXn");
printf("\t\t for(wrk-stor=
stor-stats
wrk-stor
;
!=
NULL
;
wrk-stor=
{ flt-hold=
ries)
(f loat)wrk-stor->cum-contents
*
wrk-stor->l
storage
stats
MaximumAn"
)
;
ink)
( (f loat)wrk-stor->cum-tm/(f loat)wrk-stor->ent
; flt-hold= printf
fit-hold / (float)abs-clock; %7f ("%s\t%8d %6f %7f %7d
%7d\n"
%7d
,wrk-stor->stor-nam,wrk-stor->capac
*"ity, fit-hold (f 1 t-hold/(f loat)wrk-stor->capaci ty ) wrk-s to r->cum-con tents tor>en tries) ( (f 1 oat) wrk-s tor- >cum-tm/(f loa t)wrk-s ,
,
,
wrk-s
}
} }
to r->cur-cont
,
wrk-s to
r->max-cont)
;
,
/*+
NAME: .*
addcur
**
SYNOPSIS: int addeur(wrk-cur) CUR-EVENTS
.*
"wrk-cur;
..
PURPOSE: ..
Add
new
transaction
to
the
current
events
chain.
*. *
RETURNS:
..
Nothing
**
MAINTENANCE: 7-Apr-84
jvd
created
-*/
^include ^include
stdio
^include
"[vandellon. thesis
global ref
CUR-EVENTS *ptr-cur; CUR-EVENTS *end-cur;
"[vandellon.
global ref
thesis]gpss"
]simulator"
int addcur(wrk-cur) CUR-EVENTS *wrk-cur;
{ if(ptr-cur
NULL)
==
/
add
/
easy addition,
to
an
empty
chai
/
*n
{ end-cur=
**e
ptr-cur=
wrk-cur;
wrk-cur->f or-1 ink=
NULL
chang
*/
pointers
wrk-cur->bck-l ink=
NULL;
/
make
/
correct
/
make
old
/
make
new
/
change
links
initially
/
} else
{
w rk-cu r->bck-l ink=
he
chain
end-cur-
>bck-l ink;
of
t
end
point
t
end
point
t
pointer
o
the
end
/
end-cur->bck-l ink=
wrk-cur;
/
**o
new
*o
old
*f
current
wrk-cur->f or-1 ink=
end-cur;
/ end-cur=
wrk-cur;
events
chain
/
}
}
314
end
/+
NAME: crstor
SYNOPSIS: .*
crstor(root) SYM-TABLE
.
root;
*
PURPOSE:
Create
storage
statistics.
RETURNS: Not applicable. MAINTENANCE:
14-Apr-84
jvd
created
-/
#include
stdio
#include ^include
"[vandellon. "[vandellon
globalref
STOR
thesis]gpss"
thesis]simulator"
.
stor-stats
;
int crstor(root) SYM-TABLE 'root;
{ STOR
wrk-stor;
if(root->label
==
NULL)
return;
if ((root->attr-pnt->lab-attribute) /
LAB-STOR)
==
/
is
label
/
if
stor-stats
/
create
attribute
a
storage
{ if (stor-stats */
==
NULL)
is
non
existant
wrk-stor=
stor-stats=
malloc(sizeof
(STOR))
;
areas
/
else
{ f or(wrk-stor=
stor-stats
wrk-stor->l ink=
*s
stats
;
wrk-stor->l
malloc(sizeof
(STOR) )
;
!=
NULL
;
wrk-stor=
wrk-stor->l
/
ink)
link in
storage
area
/ wrk-stor=
wrk-stor->l
ink;
} wrk-stor->stor-nam=
storage
ink
stats
wrk-s
area
/*
root->label-
put
information into
/
to r->capacity=
root->attr-pnt->leng-info;
} ts
if(root->left != NULL) down left side /
/*
look for storage
sta
/"
look for storage
sta
crstor(root->left);
if(root->right != NULL) ts down right side /
crstor( '
root
->
right) ;
}
315
/+ *
NAME:
e.
evafun
*
SYNOPSIS: int evafun(operand) SYM-TABLE
"operand
.. *
PURPOSE:
..
Evaluation
of
the
FUNCTION.
..
RETURNS: **
Integer
value
of
the
FUNCTION.
*.
MAINTENANCE: ..
29-Mar-84
jvd
created
.
^include
stdio
^include ^include
"[ vandel
int
"[vandel
1 on.
thesis]gpss"
lon.thesis]simulator"
evaf un(operand)
SYM-TABLE
"operand;
int float float
temp-fit;
i=
simrnd(
temp-flt=
for( ction
/
0;
)
/
working
holder
/*
get
/
look through the fun
/
return
simrnd();
temp-fit
attr-pnt->flo-num
return((operand->attr-pnt->pnt-info
} **er
/ /
;
i= 0 ; operand->attr-pnt->leng-inf o > data for correct range */
if(
variable
floating
data /
return(*(operand->attr-pnt->pnt-info
+
(i-1)));
}
316
+ +
i)) i ))
random
number
/
; correct
integ
/+
NAME: evaopr
SYNOPSIS: ..
int evaopr(operand, root)
SYM-TABLE SYM-TABLE
..
'operand root
..
PURPOSE: ..
Evaluation
the
of
operands
for the
simulator.
..
RETURNS: Integer value
of
the operand.
..
MAINTENANCE:
29-Mar-84
jvd
created
* -/
^include # include ^include
stdio "[vandellon.thesis]gpss"
"[vandellon. thesis ] Simula
tor"
int evaopr(operand, root) SYM-TABLE "operand; SYM-TABLE "root;
{ s
if(operand->attr-pnt->lab-attribute CONSTANT /
else
s
==
CONSTANT)
/
if label
attribute
i
/
if
attribute
i
a
a
return(,(operand->attr-pnt->pnt-info)) ; if (operand->attr-pnt->lab-attribute ==
VARIABLE
LAB-VAR)
label
/
return(evavar(operand
,
root
,
((
int)operand->attr-pnt->pnt-inf o
+
(
int)operand->attr-pnt->leng-inf
"o))): if (operand->attr-pnt->lab-attribute FUNCTION /
else
*s
a
un(operand) ) ; if(operand->attr-pnt->lab-attribute PARAMETER /
LAB-FUNC)
/
if
label
attribute
i
SNA-PARAM)
/
if label
attribute
i
return(evaf
else
*S
a
==
return(*(operand->attr-pnt->pnt-info))
;
}
317
/*+
NAME: evasto
SYNOPSIS:
int evasto( root .operand, wrk-cur) SYM-TABLE 'root SYM-TABLE 'operand *wrk-cur CUR-EVENTS
"
"
PURPOSE:
*
Evaluation
the
of
storage
A-operand.
.*
RETURNS: **
Ascii
representation
of
the
storage
label.
.. *
MAINTENANCE:
*.
13-Apr-84
jvd
created
..
-*/
^include ^include #includ"e char
stdio "[vandellon.thesis]gpss"
"[vandellon
*evasto( root SYM-TABLE
.operand,
.thesis]simulator
wrk-cur)
'root; 'operand;
SYM-TABLE CUR-EVENTS
'wrk-cur;
{ static
string[80];
int int
hold; evaopr(
/ /
)
used for decimal to working hold variable */
area
hold=
store else
evaopr(operand root) ; in hold / if(operand->attr-pnt->lab-attribute
hold=
"er
into hold sprintf
"scii
conversion
|| /*
evaluate
/
put
,
wrk-cur->param[evaopr(operand
,
==
operand
and
SNA-PARAM)
root)
-
1];
value
of
paramet
*/
area
(string
/
;
if ((operand->attr-pnt->lab-attribute == LAB-VAR) || (operand->attr-pnt->lab-attribute == LAB-FUNC) (operand->attr-pnt->lab-attribute == CONSTANT)) "
ascii
/*
"%d" ,
.hold)
;
convert
decimal
to
string /
if(hold
attr-pnt->pnt-info;
/
initialize
str-info=
fndcol
/
find
*
pointer
*/
( string str-info) ,
;
/*
if (isdigit(string[0])) "into integer */ A-operand=
atoi
(string)
':'
first
change
ascii
*/
string
;
else
{ label= "
strlab( root, string,
SEARCH)
;
/ if (label->attr-pnt->lab-attribute
/
find
/
evaluate
variable
within
variable
LAB-FUNC)
==
*
A-operand
"/ A-operand=
else
)
)
; ==
(label->attr-pnt->lab-attribute
==
A-operand=
"ng-inf o)
evaf un(label
if((label->attr-pnt->lab-attribute evavar(label
,
root
,
TEMP-VAR) LAB-VAR))
(( int)label
||
->attr-pnt->pnt-inf o
+
(
int)label->attr-pnt->le
;
} if (strcmp(str-info, "-")
==
/
0)
for
check
a
negate
/ A-operand str-info=
= A-operand; f ndcol(string, str-info) ; -
/
negate
/*
find
/
circulate
/
find
/*
evaluate
A-operand */
next
colon
/
} while(str-info
*e
string
attr-pnt->lab-attribute
==
LAB-FUNC)
/*
evaluate
B-operand
*
/ B-operand= else
8-operand=
*-pnt->leng-info))
evafun(label
)
;
if((label->attr-pnt->lab-attribute (label->attr-pnt->lab-attribute evavar(label
,
==
==
TEMP-VAR) || LAB-VAR))
root, ((int)label->attr-pnt->pnt-info
+
(int)label->attr
;
> if (strcmp(str-info,"~")
==
0)
/*
should
we
/
negate
/*
find
next
B-operand */ colon /
/
find
next
/*
is the
operand
/
is the
operator
subt
/*
is the
operator
mult
/
is the
operator
divi
negate
*/
{ B-operand str-info=
B-operand;
-
-
fndcol (string, str-info)
;
} fndcol
str-info=
if(string[0] ion
==
(string str-info) ,
ADDITION)
colon
/ addit
? / A-operand else
raction
if( string[0]
+
-
B-operand;
SUBTRACTION)
==
?? / A-operand
else
iplication else
*sion
;
if(string[0]
-
B-operand;
MULTIPLICATION)
==
DIVISION)
??? / A-operand
if(string[0]
=
==
=
B-operand;
???? / A-operand
/
-
B-operand;
} return(A-operand)
;
}
320
/+
NAME:
fndcol SYNOPSIS: *
int f ndcol(operand.pnt-info)
. .
"operand; "pnt-info;
char char
..
PURPOSE: ..
*
Find
colon
when
evaluating
string
into the location
ponter
to
variable
specified
string, and the input
by
copy the operand.
RETURNS:
**
the VARIABLE
string
nformation
MAINTENANCE: 29-Mar-84
jvd
created
-/
^include Unci ude ^include
stdio "[vandellon.thes1s]gpss"
"[vandellon.
int fndcol (operand char
pnt-info) "operand; "pnt-info;
int
ret-status;
char
thesis]simulator"
,
{ if ((ret-status= *
the
colon
strcspn(pnt-inf o,
"
:
") )
==
0)
/
use
facility
to
find
/
{ printf
(
"XnProgrammer
return(ERROR)
goof
up\n");
;
} strncpy(operand
tween
colons
,
NULL;
operand[ret-status]=
and NULL
terminate
pnt-info
=
/
pnt-info, ret-status) ;
copy
ascii
string be
/
into
space
provided
/
increase
/
/
pnt-info
*"ter
past
re turn
(pnt-info)
+
(ret-status
+
1);
string /
ascii
;
}
321
string
poin
/+
NAME: *
fndfac
* *
SYNOPSIS
**
FAC-STATS "fndfac(fac-label) int fac-label
** ** *
PURPOSE:
**
Find
the
facility
associated
this
with
transaction.
** *
RETURNS: Pointer to
facility
statistics
associated
with
this
transaction.
.. *
MAINTENANCE:
jvd
15-Apr-84
created
** -/
^include ^include ^include
stdio
globalref
FAC-STATS
"[vandellon
thesis]gpss" .
"[vandellon.thesis]simulator"
"fac-stats;
FAC-STATS *fndfac(fac-label) int fac-label ;
{ FAC-STATS FAC-STATS
s
/
*wrk-fac; *new-fac;
if(fac-stats area /
!=
/
facilty pointer facility pointer /
working new
/
NULL)
/
is there
/
look through
/
end
/
create
/
fill
a
facilitie
stats
{ for(wrk-fac=
fac-stats
wrk-fac
;
!=
NULL
wrk-fac=
;
wrk-fac->l
ink)
{ or
a
match
stats
*/ if(fac-label
==
wrk-fac->name)
break;
} if(wrk-fac
==
NULL)
new-fac=
"stats
malloc(sizeof
(FAC-STATS) )
;
stats
of
new
list
facility
*/ new-fac->link=
NULL;
new-f ac->name=
fac-label;
in
information
*/ for(wrk-fac=
fac-stats
wrk-fac->l ink=
wrk-f ac->l
ink
!=
NULL
;
wrk-fac=
wrk-f ac->l
ink)
new-fac;
NO;
wrk-fac->seized=
wrk-f ac=
;
new-fac;
} .
>
else fac-stats=
malloc(sizeof
fac-stats->link=
/
(FAC-STATS));
/*
NULL;
*
fac-stats->name= wrk-f ac=
fac-label; fac-stats;
} return(wrk-fac) ;
}
322
empty create
stats stats
list area
f
/+
NAME: f ndque
SYNOPSIS: QUE-STATS "fndque(que-label) int que-label
.*
PURPOSE: Find
the QUEUE
then
create
associated
the
queue
this
with
transaction.
If
created
not
block.
statistic
RETURNS: Pointer to queue
statistics
associated
this
with
transaction.
MAINTENANCE: "
14-Apr-84
jvd
created
. -/
^include Unci ude ^include
stdio
globalref
QUE-STATS
thesis]gpss"
"[vandel 1 on. "[vandellon. thesis ]simul
a
tor"
"ptr-que;
QUE-STATS "fndque(que-label) int que-label ;
{ QUE-STATS QUE-STATS if(ptr-que **ch
matches
"wrk-que;
/
"new-que;
/
!=
working
pointer
pointer
to
new
to
queue
queue
stats
stats
NULL)
que-label
*/
*/ /
find
/
if NULL
stats
queue
whi
/
{ for(wrk-que=
ptr-que
;
!=
wrk-que
NULL
;
wrk-que=
wrk-que->l
ink)
{ if (wrk-que->name
==
que-label)
break;
} if(wrk-que
==
NULL)
not
found
*/
..
{ new-que=
n
malloc(sizeof
(QUE-STATS) )
/
;
create
new
queue
sta
/
ts
/
new-que->link=
NULL;
new-que->name=
que-label;
fill
with
informatio
/ for(wrk-que=
ptr-que
wrk-que->l ink= wrk-que=
;
wrk-que->l
ink
!=
NULL
;
wrk-que=
wrk-que->l
ink)
new-que;
new-que;
} } else /
{ ptr-que=
mal
loc(sizeof
(QUE-STATS) )
/
;
/ '
ptr-que->l ink=
NULL;
ptr-que->name=
que-label
wrk-que=
;
ptr-que;
} return(wrk-que) ;
}
323
no
queue
create
stats
initial
/
entry
/+
NAME: *
fndstr
.*
SYNOPSIS: STOR
"fndstr(stor-label) "stor-label
char *
PURPOSE: *
Find
the
storage
associated
this
with
transaction.
.. *
RETURNS: Pointer to
storage
statistics
associated
with
this
transaction.
**
MAINTENANCE: *
jvd
14-Apr-84
created
.. -/
^include
stdio
^include #include
"[vandellon. "[vandellon.
globalref
STOR
STOR
thes1s]gpss"
thesis]simulator"
"stor-stats;
"fndstr(stor-label) "stor-label ;
char
{ STOR
/*
"wrk-stor;
f or(wrk-stor=
stor-stats
;
working
wrk-stor
!=
storage
NULL
;
pointer
wrk-stor=
/ wrk-stor->l
ink)
{ if (strcmp(wrk-stor->stor-nam,
stor-label
)
==
0)
break;
}
/
find
/
if NULL
storage
stats
/
if(wrk-stor *hus
storage
==
NULL)
undefined
/
return(error(STR-NOT-FND))
;
return(wrk-stor) ;
}
324
no
storage
/+
NAME: ..
remcur
*
SYNOPSIS: int
remcur(wrk-cur) CUR-EVENTS
"wrk-cur;
PURPOSE:
Removes
transaction
a
from the
current
events
chain
*
RETURNS: *.
Nothing
*
MAINTENANCE:
7-Apr-84
jvd
created
^include
stdio
^include
"[vandellon thesis ]gpss" "[ vande 11 on. thesi .
^include
stimulator"
CUR-EVENTS CUR-EVENTS
globalref global ref
int
ptr-cur; "end-cur;
remcur(wrk-cur) CUR-EVENTS "wrk-cur;
{ if((wrk-cur "move it / ptr-cur=
==
ptr-cur) && (ptr-cur
end-cur=
if((wrk-cur
else
""urrent
events
==
chain
==
/
end-cur))
only
one
entry
so
re
NULL;
ptr-cur) && (ptr-cur
!=
/*
end-cur))
is
it
beginning
of
c
/
{ ptr-cur->bck-l ptr-cur=
ink->for-l
ptr-cur->bck-l
ink=
ptr-cur->f or-1
ink;
ink;
}
/
else
ddle
{ wrk-cur-
on
remove
entry from
/
unlink
the
/*
both
mi
/
from the
>f or-1
ink->bck-link=
/ if(wrk-cur->bck-link
wrk-cur->bck-l
ink;
transacti
chain
!=
wrk-cur->bck-l
NULL)
ink->for-l
ink=
wrk-cur->for-l
kward */ else end-cur=
wrk-cur->for-l
ink;
}
}
325
ink;
forward
and
bac
/*+
NAME: simrnd
SYNOPSIS:
float simrnd() PURPOSE:
Create
a
random
number
in the
Floating
number
in the
range
range
from 0.0
-
1.0.
RETURNS:
from 0.0
-
1.0.
MAINTENANCE:
29-Mar-84
^include
stdio
#include #include
"[vandellon "[vandellon
float
jvd
created
thesis]simulator" .
simrnd()
{ /
int random; float temp; float flrand; int rand(); random=
temp=
/ /"
rand();
flrand=
temp / 2147483647.;
return(f 1
rand)
/* /
random;
/
integer random number from utility */ holder for random in floating point */ the random number between 0 1 / -
use
VAX
place
random
facility
number
integer
convert
;
}
326
to
*/
into float for conversion / range 0.0 1.0 */ -
/+
NAME: *
srtfut
..
SYNOPSIS: a*
int srtfut(wrk-fut) FUT-EVENTS
'wrk-fut
..
PURPOSE:
Sort future
events
chain:
add
new
BDT
..
RETURNS:
Nothing .*
MAINTENANCE: 2-Apr-84
jvd
created
-/
^include
stdio
^include ^include
"[vandellon " [vandel! on the si
global ref
FUT-EVENTS ptr-fut;
thes1s]gpss"
.
s]simulator"
.
int srtfut(wrk-fut) FUT-EVENTS wrk-fut;
{ FUT-EVENTS
/
1 ;
working
pointer
to
facility
stats
if(ptr-fut == NULL) future events chain */
/ /*
is
/
easy link NULL termi
/
both
/
place
/
find
/
check
/
change
backlink
to
change
previous
back
there
on
nothing
"the
{ wrk-fut->for-link=
wrk-f ut->bck-link=
NULL;
forward
bac
and
links /
kward
ptr-fut=
wrk-fut;
FUT-EVENTS
in
ain
NULL;
*/
"nate
to
addition
ch
/
} else for(i=
ptr-fut
;
wrk-fut->BDT
>
i->BDT
;
i=
i->bck-link)
area
to
enter
*
sure
e
/ if(i->bck-link
==
NULL)
break; if((wrk-fut->BDT
*"nd
to
chain
of
add
to
>
i->BDT)
wrk-fut->bck-link=
**ew
8181 (i->bck-link
==
NULL))
to make
*/
i->bck-link;
n
/
arrival
i->bck-link=
/*
wrk-fut;
link / wrk-fut->for-link=
vious
if(i->for-link
else chain
==
NULL)
/
your
new
end
to
pre
beginning
at
of
i->for-link;
/
i;
wrk-fut;
ut->for-link=
point
to
old
forward
/*
point
to
old
beginni
/*
correct
/*
change
"/ wrk-fut->bck-link=
/
ng
i->for-link=
for entry
*nk
to
new
backwards
li
/ ptr-fut=
*r
point
/ wrk-f
link
/
/
link
end
i;
wrk-fut;
global
pointe
beginning /
} else ink= wrk-f ut->bck-l
nto
place
wrk-f
of
chain
i->for-link->bck-link;
/
i->for-link;
/
put
back
link NULL
*/ ut->for-link=
/
;27
point
to
old
ending
i
/*
i->for-link->bck-link=
*d
to
new
end
of
chain
wrk-fut;
*/
i->for-link=
wrk-fut;
}
}
328
point
old
en
/+
NAME: *
trns-fut-cur
SYNOPSIS: .*
int
.*
trns-fut-cur( root) SYM-TABLE
"root;
..
PURPOSE: *
Add
events
events
the
onto
current
events
chain
from the
future
chain.
..
RETURNS: *
Nothing MAINTENANCE:
. .
7-Apr-84
jvd
created
-/
#include ^include ^include
stdio
"[vandellon. "[vandellon.
thesis]simulator"
FUT-EVENTS ptr-fut; *blk-stats;
globalref
BLOCK int
globalref globalref
int
thesis]gpss"
abs-clock;
trns-fut-cur( root) SYM-TABLE
'root;
{ /
FUT-EVENTS *temp-fut; CUR-EVENTS *wrk-cur; abs-clock=
working working
future
events
current
events
pointer pointer
/ / /
update
the
/
do
have
/
ADVANCE
/
so
ink;
/*
unlink
ut->cur-block, temp-f ut->BDT) ;
/
generate
/
add
ptr-f ut->BDT;
clock
to
BDT /
next
!=
while((ptr-fut
it less
is
d
/
then
NULL) &8i (ptr-f ut->BDT
abs-clock
cur-block->operator
!=
ADVANCE)
{ ure dd
events
(blk-stats
+
ptr-fut->cur-block->block)->total++;
(blk-stats
+
ptr-f ut->cur-block->block)->cur-contents++;
came
off
fut
to
rea
/
don't
need
/
} temp-fut=
ptr-fut;
if(ptr-fut->bck-link
!=
NULL)
ptr-fut->bck-l ink->for-link=
ptr-fut=
ptr-fut->bck-l
simgen( the
on
current
root
events
.temp-f
chain
==
events
GENERATE) the
next
ev
/
addcur(wrk-cur) ; **s
future
ink;
if(temp-fut->cur-block->operator
**ent
ptr-f ut->f or-1
/
chain
chain
}
}
329
to
current
event
1 2.4. # include Files
***
The
NOTE
following
capabilities of
the
and
Link File.
***
pages
the
representation
are
the
hardware, for the
an
program
Due to printing listings for the thesis project. character is is an undefined character. The *-
underscore
underscore.
330
/+
NAME: *
gpss.h
^include file containing
-
constants
for the GPSS
compiler .*
SYNOPSIS: "
*
^include
gpss
PURPOSE:
**
^include file containing constants for the GPSS
..
RETURNS: ""
Not applicable.
..
MAINTENANCE: 7-June-83
jvd
created
/
SUCCESS ERROR ON OFF YES NO
#define #define ^define #define #define ^define #define ^define ^define #define struct
0 -1
1 0
MAXLINE
NUMB-KEY-WORDS EOL COMMA
1 0 132 19 -1 -2
keyword
{ *keyword;
char
}keyarray[NUMB-KEY-WORDS]=
{ "ADVANCE", "ASSIGN". "DEPART". "END", "ENTER", "FUNCTION", "GATE". "GENERATE", "LEAVE". "QUEUE". "RELEASE". "SEIZE". "SIMULATE". "START", "STORAGE", "TERMINATE" .
"TEST". "VARIABLE", "TRANSFER"
}; /
Numeric
ei equivalents
for GPSS
commands
/
ENTER
1 2 3 4 5 6 7 8 9 10 11 12 13
LEAVE
14
#def ine #def ine
SIMULATE
#def ine #def ine #def ine #def ine #def ine #def ine #def ine #def ine #def ine #def ine 0def ine #def ine
END STORAGE VARIABLE FUNCTION
START
GENERATE TERMINATE ADVANCE ASSIGN
SEIZE RELEASE
331
compiler.
QUEUE DEPART GATE TEST ^define TRANSFER
15 16 17 18 19
^define tfdefine #define tfdefine /
Additions to ^define
#define #define ^define #define #define ^define ^define #define
the
expansion
of
the
pseudo
code
50 51 52 53 54 55 56 57 58 59 60 61 62
EQ
#define GT #define LT #define BR #define
due to
commands
BE BNE U NU SF SE SNE SNF NEG
numerical
equivalents
for GPSS
errors
/
1
#define
NO-END ^define REQ-OPER ^define LAB-NOT-ALW #define NO-OPER ^define SYNTAX #define ILL-OPT ^define ILL-LAB ^define OPEN-ERR #define #define
FINISH-ERR
#define
LAB-REQ
#define
ILL-NONNUM
#define tfdefine #define
ILL-OPER
2 3 4
5 6 7 8 9 10 11 12 13
REP-LABEL ^define MULT-SIM #define MULT-END #define UN-OPER it/define TOO-START
14
15 16 17 18 19
LAB-NO-STAT
PRE-END
#define
ILL-FUNC
(Cdefine
MIS-FUNC
#define #define
OP-NVLD
20 21 22 23
ILL-VAR-DEF
24
^define COMPILER #define UN-LABEL #define PAR10 ^define STR-NOT-FND
25 26 27
/*
search
keys
for
the
symbol
table
/
^define
SEARCH
structure
-2
defineitions for the
symbol
table
*/ struct
LAB-
{ lab-attribute;
int
define define define
LAB-STOR
define
LAB-FUNC LAB-ASSIGN
define
int
int
/
label
/
self
attributes
/
explanatory
/
LAB-
LAB EL LAB-VAR
define define
SNA-PARAM
define
TEMP-VAR
define
CONSTANT
SNA-RANOOM
leng-info; pnt-info;
/ /
332
length where
of
storage,...
information
is
/
locaieu
int double
func-spec;
/
type
f lo-num;
/*
floating
/
tree
}: typedef struct
LAB*
struct
of
function point
-
numeric
of
number
random
LAB;
IDENT-
for the
structure
symbol
{ char
LAB struct struct
"label; "attr-pnt; IDENT"right; IDENT"left;
/ /
text
where
pointer
/
right
/
left
IDENT-
struct
/
structure
definitions for info
gathered
struct
by first
STRT-
{ int int 0
sim-time; print; NP
define define
0
PRT
int
OFF ON
interval-print;
}: typedef
STRT-
struct
INFO-STRT:
/
for
definitions ^define
variable
parsing
ADDITION
SUBTRACTION ^define MULTIPLICATION #define DIVISION #define UNARY
^define
structure
for the
pseudo
language
'/ struct
CODE-
{ int int SYM-TABLE SYM-TABLE struct CODE
block; operator;
"A-operand; "B-operand; "code-link;
}; typedef
struct
CODE-
CODE;
333
label
pass
is
stored
attributes
portion
SYM-TABLE;
/
to
portion
}: typedef
D for discrete / data */
of of
tree tree
/ / */
/
table
/
/+
NAME: ..
simulator.
h
..
SYNOPSIS: .*
^include "[vandellon.
thesis]simulator"
^include information
needed
*.
PURPOSE: ..
to
gather
*.
RETURNS: ..
Not
applicable.
.* .
MAINTENANCE:
**
29-MAr-84
jvd
created
.. .*
struct
block
{ int cur-contents; int total ;
}: typedef struct
struct
block
BLOCK;
fac-stats
{ struct
int int int int int
fac-stats
"link;
name; cum-time;
total-ent; seize-block; seized;
}: typedef
struct
struct
FAC-STATS;
fac-stats
que-stats
{ struct
int int int int int int int
que-stats
*link;
name; max-content; cum-time;
total-que; total-ent; zero-ent; cur-contents;
}; typedef struct
struct
QUE-STATS;
que-stats
fut-events
{ struct
fut-events fut-events
struct
code
struct
int int FAC-STATS int QUE-STATS int struct
for-link; bck-link; cur-block; BDT; truth-bit; ptr-f ac ; time-sez ;
ptr-que
;
time-que ;
stor-stats
int int int
ptr-stor; time-stor ;
blk-from; param[10] ;
}: typedef
struct
struct
fut-events
FUT-EVENTS;
cur-events
{ struct
cur-events
for-link;
334
simulation
statistics.
struct
cur-events
bck-l1nk;
struct
code
cur-block; BDT;
int int FAC-STATS int QUE-STATS int struct
truth-bit; ptr-fac; time-sez; ptr-que
;
time-que;
stor-stats
int int int
ptr-stor; time-stor; blk-from; param[10] ;
}: typedef
struct
struct
cur-events
CUR-EVENTS;
stor age-stats
{ struct
storage-stats
link;
stor-nam;
char
nt
capacity;
nt
cum-tm;
i nt
cum-contents
i nt
entries; cur-cont ;
nt
I nt
max-cont ;
}; typedef
struct
storage-stats
STOR;
j j:
! !
phase
1:
PARSING
the GPSS
cf
language
!
Slink/executable=gpss
gpss.gpspassl
,
gp se r r, g e two rd, key word, label, strlab,
-
prssim,prsstr,prsend,prssto,prsvar.prsfun,prsgen, prs
prsbl kl.prstra, lo, get var, itoa,
ter.prsadv, prsass.prsgat.prstst,
prsblk2,prsnum,prsolb,prslab conu nary, vaddsub
,
Idiv
vmu
,
prsf
.prsymtab
-
,
! !
phase
2:
PSEUDO CODE
generation
t
gpspass2,crepsd.ps2tst
,
i
!
phase
3:
SIMULATOR
i
gpssim, simgen
simrnd evaop r, evavar, evaf un , evasto.crstor.fndstr,srtfut.putcur.addcur, remcur f ndque, f ndf ac -
,
.fndcol
.
,
,
sunadv
,
simass
simque, simdep simbne,
,
,
simbr, simneg s imsez , simrel
-
report
336
,
simcmp
,
simf ac,
simstor,
-
13.
User
Manual.
Introduction.
13.1.
The consists
following
3
control
3 makes
use
of
The following storage
are
to
when
a subset of
the GPSS language.
This
workable subset
statements
4
numerical
the
specification
variable
specification
parameter--*?
parameter
specified
in
the
and
specification
variable-label
otherwise
function,
in block definition statements
function
v*
p*
parameter, variable,
and storages used
storage
function-label
attributes.
specifications.
functions,
storage-label *
computational
terminology integer,
operand
All parameters, variables, be of the form:
fn
and
pages use the
describing
s*
unless
describe
block definition statements entity definition statements
13
and
pages
of
specification
documentation.
no allows for a free-form style of coding; in place. Also, capital and lower cases letters are allowed. Please note, when a label has been described in either upper or lower case letters, the references to that label, through out the program, must remain consistent.
The thesis GPSS language implementation
column
restrictions are
The format for the GPSS
$ No
qualifiers
gpss
are
command
line is
as
follows:
filename.extension allowed
on
the
command
337
line in
this
version
of
GPSS.
13.1.
Control
Statements.
Statement:
END Syntax: END
Description:
This must be the last statement of the source GPSS program. This statement signals to the first pass of the assembly phase that there is no more input and indicates the start of the second
phase.
Examples: 1.
SIMULATE
END Last
statement
in the
GPSS
program.
338
Statement:
SIMULATE Syntax:
SIMULATE
Description: A SIMULATE statement requests a GPSS model is parsed but not
simulation run. executed.
Examples: 1.
SIMULATE
END Execute the
model.
339
Without
a
SIMULATE statement, the
Statement:
START Syntax:
START
Operands: Operand A B
A, B, C
Required
Description
required
run
Operand Specifications integer NP no statistics
of operand
termination count
print suppression
indicator
-
printed
snap interval
NULL integer
print count
print
Description:
Operand A summary
specifies the number of terminations to
statistics.
negative value,
the
run
the
When the run
run
terminates.
termination count is decremented
The B-operand is statistical
self-explanatory.
output when
be
executed
before printing the final
termination count is decremented to zero or to a Each time a transaction enters a TERMINATE block,
by the TERMINATE
Operand C is
decremented to
zero or
a count
statement's
which
to a negative value
will
by
A-operand.
print
a
normal
the A-operand.
Examples: 1
START 10 Execute the
model
for
10
transaction
terminations.
START 10, NP Execute the model for 10 transaction terminations
and
do not print the
statistical
results.
START 10, 2 Execute the model for 10 transaction terminations each 2 transaction terminations. ,
340
and
print statistical results after
13.2.
Block-Definition
Statements.
Statement:
ADVANCE Syntax:
ADVANCE
Operands: Operand A
Required
Description
required
time
of operand
delay
Operand Specifications variable, or
function, integer,
parameter
Description:
This block is
used
A-operand.
The transaction
to
delay entering is
transactions for the amount of time specified denied entry into this block.
not
Examples: 1.
ADVANCE 1
Delay 2.
the
transaction
ADVANCE P'1 Delay the transaction
in
this
for the
block
1
amount
341
time
of
unit.
time
specified
in
parameter
1.
by the
Statement:
ASSIGN Syntax:
Operands: Operand A
ASSIGN
A,
Required
Description
required
parameter number
B
[sign]
of operand
Operand Specifications
integer, or
B
required
value
to be
subtracted
added to from the
or
parameter,
integer, or
function,
variable
parameter,
function,
variable
parameter sign
addition or subtraction
required
+
or
-
operator
Description:
This block enters B is preceded by the
transaction
or modifies
a
+
or
always
the value
of a
transaction parameter.
The ASSIGN block
-.
will
proceed
to
the
The
value of operand
entry to a transaction, and next sequential block. never refuses
Examples: 1.
2.
ASSIGN 1,-2 Decrement the
contents
ASSIGN 1, + P*2 Add the contents
of
of
parameter
parameter
1
2 to the
342
by 2.
contents
of
parameter
1.
Statement:
DEPART Syntax:
Operands: Operand A
DEPART
A, B
Required
Description
required
number of
Operand Specifications
of operand
the queue
integer, or
B
to be from the queue; default is 1
parameter, variable,
function
number of units
integer,
removed
or
parameter, variable,
function
Description:
This block decreases the queue entity contents by the quantity specified by the Boperand. If the B-operand in not specified, a default of 1 is assumed. No transaction is ever refused entry to a DEPART block. A transaction does not have to remove the same number
of
units
which
it
added
to
a
queue
entity
via
a
QUEUE block.
Examples: 1.
DEPART
Remove 2.
DEPART
1 1
unit
from
queue
1.
VVAR1, P*1
Remove the number of units specified by is given by the variable VARL
343
parameter
1 from the queue whose number
Statement:
ENTER Syntax: ENTER
Operands: Operand A
A, B
Required
Description
required
storage number or name
B
of operand
number of units of
default is 1
storage;
Operand Specifications
integer,
parameter,
variable
or
integer, or
label,
function
parameter,
function,
variable
Description:
Operand A
specifies the storage to be accessed, and the B-operand specifies the the storage units to be occupied. This block does not permit the transaction to enter if the storage units are full or unavailable. A transaction can enter a different If the storage capacity is amount of storage units than it leaves via the LEAVE block. available, the transaction can enter the block, causing the storage amount to be decremented by the value contained in the B-operand. If the B-operand is not specified, number of
the storage
amount
is decremented by 1.
Examples: 1.
ENTER
The 2.
S*STORAGE1
storage
ENTER
Storage
specified
by
the
storage
label, STORAGE1,
3, 2 number
3
is decremented by 2.
344
is decremented
by
1.
Statement:
GATE Syntax:
GATE A
B, C
Operands:
Operand
Required
Description
A
required
comparison qualifier
B
required
entity
of operand
number or name
Operand Specifications U facility used NU facility not used SF storage full SE storage empty SNF storage not full SNE storage not empty storage
variable,
label, function, integer, or
parameter
C
exit when condition not
label
satisfied
Description:
The GATE block status of
the
alters or
particular
impedes the flow
facility
transactions through the model. The is tested according to the comparison If the condition is true, the transaction enters the of
or storage area
by the A-operand. block. If the condition is false, the transaction transfers to the label specified in the C-operand, if specified. Otherwise, the transaction is delayed from entering into the block until the test becomes true. qualifier specified
next
Examples: 1.
GATE U
Facility
1
continues specified
2.
1, LABEL1 is tested to see if it is to the next block. by LABEL1
If
utilized.
false,
If the comparison is true, the transaction the transaction goes to the program area
.
GATE SF S'STORAGEI, LABEL1 The storage specified by the name STORAGE1 is tested to see if it is full. If the If false, the comparison is true, the transaction continues to the next block. transaction
goes
to
the
program
area
345
specified
by LABELL
Statement:
GENERATE Syntax:
Operands: Operand A B
GENERATE
A, B
Required
Description of operand mean integration time time spread
required
Operand Specifications
integer, integer,
variable, variable,
function, function,
Description:
This block
creates transactions to enter the model at the next sequential
block.
The
"intercreation"
time between successive transactions. The time when the transaction is created is in the range of 'AB-operand' operand to 'A-operand + B-operand', if the B-operand is a constant; a random number generator is used to develop an equal distribution in the specified range. B-operand' * The time when the transaction is created is in the range of 'A-operand to creation
rate of transactions
is
in terms
specified
of an
-
'A-operand
*
B-operand', if the B-operand is
a
function
or
variable.
Examples: 1.
2.
GENERATE 100, 5 Generate a transaction GENERATE
Generate time
a
in
the
range
of
every 95 to
105
time
units.
FN*FUNC2, VVAR3 transaction in the range
of
units.
346
every 'FUNC2
*
VAR3'
to 'FUNC2
*
VAR3'
Statement:
LEAVE Syntax:
LEAVE
A, B
Operands:
Operand A
Required
Description
required
storage name or number
Operand Specifications
of operand
integer,
variable,
parameter,
B
number of units of storage;
integer,
default is 1
or
or
function,
label
variable,
function,
parameter
Description:
The LEAVE block
makes available previously occupied contents in a storage entity. This block never refuses entry to a transaction. The storage area specified by the A-operand has the amount of storage specified in the B-operand made available. If the B-operand is not specified, the default is 1 unit of storage.
Examples: 1.
LEAVE
Storage 1 2.
LEAVE
The
by
S*1, 2 has its
storage
amount
increased
by
2.
S*STORAGE1
storage specified
the default
of
by
the name
of
1.
347
STORAGE1 has its storage amount increased
Statement:
QUEUE Syntax:
QUEUE
A, B
Required
Description of operand number of the queue
Operands:
Operand A
required
Operand Specifications
integer, or
B
number of units
to be
added
to the queue; default is 1
integer, or
variable,
function,
parameter
variable,
function,
parameter
Description:
The QUEUE block is provided to select points in the model where queue sizes need to be measured. No transaction is ever refused entry into a QUEUE block. This block adds the
number
referenced
of
by
units,
the
specified
by
the
B-operand, to the
contents
of
the
queue,
A-operand.
Examples: 1.
QUEUE
Queue 2.
1, 2 number
1
1 QUEUE Queue number 1
gets
2
gets the
units
of
default
the
of
transaction.
348
queue
1
unit
used
of
by
the
the queue
incoming
used
transaction.
by the incoming
Statement:
RELEASE Syntax:
RELEASE
Operands:
Operand A
Required
Description
required
number of
of operand
the
facility
Operand Specifications
integer, or
variable,
function,
parameter
Description:
This block releases a facility previously seized via the SEIZE block, therefore making it The transaction is never refused entry into the available for another transaction. RELEASE block. The releasing transaction must be the transaction which had previously seized
the facility.
Examples: 1.
RELEASE 1 Release facility
1.
349
Statement:
SEIZE Syntax:
SEIZE
Operands:
Operand A
Required required
Description of operand number of the facility
Operand Specifications
integer, or
variable,
function,
parameter
Description:
This block
seizes a
transaction
cannot
contains
the
index
facility, making
the facility unavailable to any the SEIZE block if the facility is being number of the facility to be seized.
enter
Examples: 1.
SEIZE
1
Seize facility 1.
350
other
A Operand A
transactions.
utilized.
Statement:
TERMINATE Syntax: TERMINATE
Operands: Operand A
Required
A
Description
of operand
number of units
the
is
run
by
which
termination
Operand Specifications integer
count
reduced
Description:
This block destroys the entering transaction, thus removing the transaction from the model. A TERMINATE block never refuses a transaction entry. The run termination is decremented by the value specified by the A-operand. If the A-operand is not specified, the transaction is destroyed but the run termination count is not decremented. count
Examples: 1.
2.
TERMINATE The transaction is destroyed but the TERMINATE
The
run
run
termination count is
10
termination
count
is decremented
351
by
10
units.
not
decremented.
Statement:
TEST Syntax:
TEST A
Operands: Operand A
B, C, D
Required
Description of operand
required
algebraic comparison
Operand Specifications equal to E L less than G greater than -
-
B
required
SNA to be
compared
parameter, variable,
C
required
SNA to be
compared
parameter, variable,
to B label
D
integer,
function
or
integer,
function
or
valid
label
Description: controls the flow of transactions by testing the algebraic relation between B and operand C. If operand D is not specified, transactions cannot enter the TEST block until the algebraic relation is true. If operand D is specified, transactions are If the relation between the B and C operand is true never refused entry into the block. If as specified by the auxiliary operand A, the transaction proceeds to the next block. the relation is false, the transaction proceeds to the block specified by operand D.
This block operand
Examples: 1.
TESTE
Delay 2.
the
P*1,
1
transaction
until
the contents
of
TEST L VABC, 2, LABEL1 If variable ABC is less than 2 continue to the defined by LABELL
352
parameter
next
block,
1
else
is
equal
to
1.
if false go to the block
Statement:
TRANSFER Syntax: TRANSFER
Operands: Operand B
,B
Required
Description label
required
of operand
Operand Specifications label
valid
Description:
This block unconditionally transfers the transaction to the A-operand.
program
block specified
by
the
Examples: 1.
TRANSFER Transfer the flow
,LABEL1
of
the
program
to the block specified
353
by
the
label, LABELL
13.3.
Entity-Definition
Statements.
Statement:
FUNCTION Syntax: label
FUNCTION
decimal,
/'nfegerl
A, B / decimal!, integer!
/
/ decimals, integem
..
Operands:
Operand
Required
label A
required
Description of function label
required
random number specification
B
required
function
valid
and number of
points
decimalrt
integem
required
required
number
value of
Operand Specifications
operand
R Dn
label
where
n
is the
number
points
in the
the
range
range
0.0
-
1.0 decimal O.n or
number .n,
in the form
where
n
can
be multiple integers integer value
Description:
The FUNCTION
card
defines
a standard numerical
that make up the function.
attribute, the type
Operand A for this
of
function,
and
the
is only defined for one random number. Operand B for this project can only be defined to be a discrete function with number of points n. Each function must have at least two points number of points
defined.
Examples: 1.
FUNC1
FUNCTION
R, D2
0.1,10/0.55,2
354
project
Statement:
STORAGE Syntax: label
Operands: Operand label
A
STORAGE
Required
A
Description label
Operand Specifications
of operand
required
storage
required
number of storage units
integer integer
or
valid
label
Description:
This
defines the capacity of each storage area that is capacity assigned to the storage area. defined by each STORAGE statement. card
operand contains the
be
in the
used
Only
model.
Examples: 1.
STOR1 STORAGE 1 The storage area STOR1
is defined to have
355
a
capacity
The
A-
one storage area can
of
1
unit.
Statement:
VARIABLE Syntax: label
Operands: Operand
VARIABLE
Description of operand label variable definition
Required
label A
A
required
variable
required
Operand Specifications label
valid
integer, function,
other
previously defined variables, and
parameters
arithmetic +
,
-,
*,
are
legal
units; and
/
are
legal
arithmetic operators
Description:
This
statement
with
*
and
/
defines
an arithmetic variable.
given
priority
over
+
and
The variable is evaluated from left to right, No parentheses are allowed.
-.
Examples: 1.
VAR1 VARIABLE The variable, VAR1
32 ,
*
9
multiplies
+ P*2 32 by 9 and adds the
2.
356
result
to the contents
of parameter