appendix a. pascal syntax flow
TRANSCRIPT
1
Appendix A
Pascal Syntax Flow Graph
This Pascal syntax flow graph is a copy from “Pascal User Manual and Report” by Kathleen Jensen and Niklaus Wirth (Springer-Verlag, 1974) with a courtesy of the publisher. Refer this book for further details of Pascal grammar.
2
<program>
PROGRAM identifier identifier( ) ; block .
,
CONSTANT identifier = constant
;
TYPE identifier = type
;
,
VAR identifier : type
;
LABEL Unsigned integer
,
;
; block ;
parameter listidentifierPROCEDURE
parameter listidentifierFUNCTION identifier:
BEGIN statement END
;
<block>
Pascal Syntax Flow Graph
3
unsigned integer :
variable := expression
function identifier
BEGIN ENDstatement
;
expression constant statementCASE OF : END
,
;
expression statementWHILE DO
expression statementREPEAT UNTIL
;
Variable identifier expression expressionFOR := TO DO
statementDOWNTO
variable statementWITH DO
,unsigned integerGOTO
function identifier expression
procedure identifier
( )
,
expression statement statementIF THEN ELSE
<statement> Pascal Syntax Flow Graph
4
letter
digit
<identifier>
letterdigit
<unsigned integer>
<unsigned number>
unsigned integer unsigned integer. unsigned integer E
+
-
Pascal Syntax Flow Graph
constant identifier
unsigned number
NIL
character
<unsigned constant>
''
constant identifier
unsigned number
character
+
-
<constant>
''
5
<simple type>
type identifier
identifier
constant constant
)(
,
..
simple type
type identifier
simple type type
type
simple type
field list
,
[ ] OFARRAY
PACKED
FILE OF
SET OF
RECORD END
<type>
identifier
identifier type identifier
constant field list
type
;
,
:
CASE : OF
: ( )
,
;
<field list>
Pascal Syntax Flow Graph
6
<variable>
variable identifier
identifier
field identifier
][
,
.
field identifier
<factor>unsigned constant
variable
expression
expression
factor
expression
,
(
(
NOT
)function identifier
)
[ ]
..
,
expression
factor
factor
*
/
DIV
MOD
AND
<term>
Pascal Syntax Flow Graph
7
term
+
+
-
term
- OR
<simple Expression>
identifier type identifier
identifier
)
,
PROCEDURE
VAR
FUNCTION ,
;
:(
<parameter list>
Pascal Syntax Flow Graph
simple expression
=
simple expression
< > IN
<expression>