Browsable Pascal Grammar

CC-BY

Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: pascal/pascal/bruneliere/extracted
Source used for this grammar: Hugo Brunelière, Pascal 0.1, Pascal.ecore, 2005/08/10

Summary

Syntax

Program ::=
	[name]::String [variables]::Variable+ [types]::Type+ [procedures]::Procedure+
Variable ::=
	Parameter
Variable ::=
	[name]::String [program]::Program [procedure]::Procedure [type]::Type
Type ::=
	[name]::String [program]::Program [variables]::Variable+
Parameter ::=
	[procedure_parameter]::Procedure
Instruction ::=
	Calculation
Instruction ::=
	Control
Instruction ::=
	Assignment
Instruction ::=
	Block
Instruction ::=
	[block]::Block
Calculation ::=
	[block]::Block
Control ::=
	Conditional
Control ::=
	Loop
Control ::=
	Procedure
Control ::=
	Conditional
	Loop
	Procedure
Assignment ::=
	[block]::Block
Block ::=
	[instructions]::Instruction+ [procedure]::Procedure [loop]::Loop [conditional]::Conditional
Conditional ::=
	[blocks]::Block
Loop ::=
	For
Loop ::=
	While
Loop ::=
	Repeat
Loop ::=
	[block_loop]::Block
Procedure ::=
	Function
Procedure ::=
	[name]::String [program]::Program [variables]::Variable+ [parameters]::Parameter+ [block_procedure]::Block
Function ::=
	[returnType]::Type
For ::=
	[block_loop]::Block
While ::=
	[block_loop]::Block
Repeat ::=
	[block_loop]::Block
String ::=
	string

GrammarLabMaintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated in September 2015. []