0% found this document useful (0 votes)
72 views

Program Id (Identif Ier List) : Mini PASCAL Grammar

This document defines the grammar for a Mini PASCAL programming language. It outlines the structure of a program including declarations, subprogram declarations, and statements. It also defines the basic elements such as variables, expressions, and types that make up a Mini PASCAL program.

Uploaded by

mudrii
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Program Id (Identif Ier List) : Mini PASCAL Grammar

This document defines the grammar for a Mini PASCAL programming language. It outlines the structure of a program including declarations, subprogram declarations, and statements. It also defines the basic elements such as variables, expressions, and types that make up a Mini PASCAL program.

Uploaded by

mudrii
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Mini PASCAL Grammar

program →
program id ( identif ier list ) ;
declarations
subprogram declarations
compound statement
.

identif ier list →


id
| identif ier list , id

declarations →
declarations var identif ier list : type ;

type →
standard type
| array [ num .. num ] of standard type

standard type →
integer
| real

subprogram declarations →
subprogram declarations subprogram declarion ;

subprogram declaration →
subprogram head declarations compound statement

subprogram head →
function id arguments : standard type ;
| procedure id arguments ;

arguments →
( parameter list )

parameter list →
identif ier list : type
| parameter list ; identif ier list : type

compound statement →
begin
optional statements
end

1
optional statements →
statement list

statement list →
statement
| statement list ; statement

statement →
variable assignop expression
| procedure statement
| compound statement
| if expression then statement else statement
| while expression do statement

variable →
id
| id [ expression ]

procedure statement →
id
| id ( expression list )

expression list →
expression
| expression list , expression

expression →
simple expression
| simple expression relop simple expression

simple expression →
term
| sign term
| simple expression addop term

term →
f actor
| term mulop f actor

f actor →
id
| id ( expression list )
| num
| ( expression )
| not f actor

sign →
+|−

You might also like