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.
1
Pascal Syntax Flow Graph
<program>
PROGRAM identifier ( identifier ) ; block .
<block> ,
LABEL Unsigned integer
,
;
CONSTANT identifier = constant
TYPE identifier = type
VAR identifier : type
,
;
; block ;
PROCEDURE identifier parameter list
FUNCTION identifier parameter list : identifier
BEGIN statement END
2
unsigned integer : <statement> Pascal Syntax Flow Graph
variable := expression
function identifier ,
function identifier ( expression )
; procedure identifier
BEGIN statement END
IF expression THEN statement ELSE statement
CASE expression OF constant : statement END
,
;
WHILE expression DO statement
REPEAT expression UNTIL statement
statement
; DOWNTO
FOR Variable identifier := expression TO expression DO
WITH variable DO statement
,
GOTO unsigned integer 3
Pascal Syntax Flow Graph
<identifier>
letter <unsigned integer>
letter
digit
digit
<unsigned number>
+
unsigned integer . unsigned integer E unsigned integer
-
<unsigned constant> <constant>
constant identifier + constant identifier
unsigned number unsigned number
-
NIL
' character '
' character '
4
Pascal Syntax Flow Graph
<type>
simple type
<simple type>
type identifier
type identifier
PACKED ,
( identifier ) simple type type
ARRAY [ ] OF
,
FILE OF type
constant .. constant
SET OF simple type
<field list> RECORD field list END
;
identifier : type
CASE identifier : type identifier OF
;
,
constant : ( field list )
5
Pascal Syntax Flow Graph
<variable>
variable identifier
field identifier [ identifier ]
. field identifier <term>
factor
<factor> factor
unsigned constant
*
variable
,
/
function identifier ( expression )
DIV
( expression )
MOD
NOT factor
AND
[ ]
expression .. expression
,
6
Pascal Syntax Flow Graph
<simple Expression>
+
term
-
+ - OR
<expression> term
simple expression
= < > IN
simple expression
<parameter list>
( identifier : type identifier )
FUNCTION ,
VAR ,
PROCEDURE identifier