appendix a. pascal syntax flow

7
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.

Upload: kims3515354178

Post on 18-Nov-2014

187 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Appendix A. Pascal Syntax Flow

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.

Page 2: Appendix A. Pascal Syntax Flow

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

Page 3: Appendix A. Pascal Syntax Flow

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

Page 4: Appendix A. Pascal Syntax Flow

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>

''

Page 5: Appendix A. Pascal Syntax Flow

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

Page 6: Appendix A. Pascal Syntax Flow

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

Page 7: Appendix A. Pascal Syntax Flow

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>