Browsable Program Grammar

CC-BY

Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: toy/program/extracted
Source used for this grammar: Frédéric Jouault, Program 0.1, Program.ecore, 2007/03/07

Summary

Syntax

LocatedElement ::=
	NamedElement
LocatedElement ::=
	Expression
LocatedElement ::=
	Statement
NamedElement ::=
	Structure
NamedElement ::=
	VariableDeclaration
NamedElement ::=
	Type
Structure ::=
	ProcContainerElement
Structure ::=
	Procedure
ProcContainerElement ::=
	Program
ProcContainerElement ::=
	Monitor
Program ::=
	[monitors]::Monitor+
Monitor ::=
	[program]::Program
Procedure ::=
	[container]::ProcContainerElement [parameters]::Parameter+ [statements]::Statement+
VariableDeclaration ::=
	Parameter
VariableDeclaration ::=
	[type]::Type [initialValue]::Expression [structure]::Structure
Parameter ::=
	[direction]::Direction [procedure]::Procedure
Direction ::=
	[in]::ε
	[out]::ε
Type ::=
	[name]::String
Expression ::=
	VariableExp
Expression ::=
	PropertyCallExp
Expression ::=
	LiteralExp
VariableExp ::=
	[declaration]::VariableDeclaration
PropertyCallExp ::=
	OperatorCallExp
PropertyCallExp ::=
	AttributeCallExp
PropertyCallExp ::=
	ProcedureCallExp
OperatorCallExp ::=
	[right]::Expression
AttributeCallExp ::=
	[source]::Expression [name]::String
ProcedureCallExp ::=
	[arguments]::Expression+
LiteralExp ::=
	BooleanExp
LiteralExp ::=
	IntegerExp
BooleanExp ::=
	[symbol]::Boolean
IntegerExp ::=
	[symbol]::Integer
Statement ::=
	AssignmentStat
Statement ::=
	ConditionalStat
Statement ::=
	WhileStat
Statement ::=
	ExpressionStat
AssignmentStat ::=
	[target]::VariableExp [value]::Expression
ConditionalStat ::=
	[condition]::Expression [thenStats]::Statement+ [elseStats]::Statement+
WhileStat ::=
	[condition]::Expression [doStats]::Statement+
ExpressionStat ::=
	[expression]::Expression
Boolean ::=
	"true"
	"false"
Integer ::=
	integer
String ::=
	string

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