BNF for SCL Statements Syntax

BNF for SCL Statements Syntax

 

This section presents the Simulation Control Language statements expressed formally in the BNF syntax.

Syntax of actions, events, conditions, expressions is the same as in the specification itself. One may use SCL variables defined in the SCP in any Rational Statemate expression except for event expressions. For example, while make_true(c), where c is a local boolean variable, is legal, TRUE(C) is not.

scp_program => PROGRAM program_name ;

[declaration_section]

[init_part]

[breakpoint_part]

[main_part]

END.

init_part => INIT

sequence_of_statements[;]

END INIT[;]

breakpoint_part => breakpoint_definition

{breakpoint_definition}

breakpoint_definition => SET BREAKPOINT
[br_name=>] br_trigger DO

sequence of statements[;]

END BREAKPOINT[;]

br_trigger => event

| EVERY expression

main_part => BEGIN

sequence_of_statements[;]

END[;]

declaration_section => [CONSTANT const_decl_list]

[VARIABLE var_decl_list]

const_decl_list => const_decl; {const_decl;}

const_decl => const_type id_val_list

const_type => INTEGER

| FLOAT

| STRING

| BIT

| ARRAY

id_val_list => id := expression {,id := expression}

var_decl_list => var_dec; {var_dec}

var_dec => [GLOBAL] type id_opt_val_list

simple_type => INTEGER

| FLOAT

| STRING

| FILE

| BOOLEAN

| BIT

id_opt_val_list => id [:= expression] {,id [:= expression]}

type => simple_type

| array_type

array_type => (constant..constant) of simple_type

bit_arrau type => bit-array name (1..6)

sequence_of_statements => scl_statement {; scl_statement}

scl_statement => simple_statement

| structured_statement

| io_statement

simple_statement => assign_statement

| set_statement

| go_statement

| random_solution_statement

| skip_statement

| undo_statement

| restore_statement

| save_statement

| choose_statement

| exec_statement

| stop_statement

| simple_action_statement

structured_statement => if_statement

| for_loop

| when_statement

| while_loop

io_statement => read_statement

| write_statement

| open_statement

| close_statement

assign_statement => ASSIGN activity_id scp_name

scp_name => string_constant

set_statement => set_operation BREAKPOINT br_name

| set_operation TRACE

| set_operation DISPLAY

| SET INFINITE LOOP
expression

|SET INTERACTIVE

| SET GO BACK expression
| set_operation REPORT RACING

set_operation => SET

| CANCEL

simple_action_statement => action

go_statement => GO [go_type]

go_type => STEP

| REPEAT

| NEXT

| ADVANCE

| EXTENDED

| STEPN

random_solution_statement=> RANDOM_SOLUTION

skip_statement => SKIP

undo_statement => GO BACK

restore_statement => RESTORE_STATUS
status_name

save_statement => SAVE_STATUS status_name

choose_statement => CHOOSE expression

exec_statement => EXEC scp_name

stop_statement => STOP_SCP [scp_name]

scp_name => string_constant

status_name => string_constant

file_name => string_constant

if_statement => IF condition THEN

sequence_of_statements[;]

[ELSE

sequence_of_statements[;]]

END IF;

when_statement => WHEN event THEN

sequence_of_statements[;]

[ELSE

sequence_of_statements[;]]

END WHEN;

while_loop => WHILE condition LOOP

sequence_of_statements[;]

END WHILE;

for_loop => FOR condition LOOP

sequence_of_statements[;]

END FOR;

read_statement => READ([file_var,] id_list)

write_statement => WRITE([file_var,]
write_expression_list)

open_statement => OPEN(file_var, file_name,
INPUT)

| OPEN(file_var, file_name, OUTPUT)

close_statement => CLOSE(file_var)

file_var => id

id_list => id {,id}

write_expression_list => write_expression
{,write_expression}

write_expression => expression [, expression]

| event [; expression]

| condition [;expression]