Browsable Clafer Grammar

CC-BY

Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: clafer/unknown/connected
Source used for this grammar: Source unknown, This grammar looks like it was copy-pasted from a PDF, 15 June 2012

Summary

Syntax

Module ::=
	ListDeclaration
Declaration ::=
	"enum" Ident "=" ListEnumId
	Clafer
	Constraint
Clafer ::=
	Abstract GCard Ident Super Card Elements
Constraint ::=
	"[" ListLExp "]"
Abstract ::=
	ε
	"abstract"
Elements ::=
	ε
	"{" ListElement "}"
Element ::=
	Clafer
	"‘" Name Card Elements
	Constraint
Super ::=
	ε
	":" Name
	"extends" Name
	"−>" ListModId SExp
GCard ::=
	ε
	"xor"
	"or"
	"mux"
	"opt"
	"<" GNCard ">"
Card ::=
	ε
	"?"
	"+"
	"*"
	NCard
GNCard ::=
	Integer "−" ExInteger
NCard ::=
	Integer ".." ExInteger
ExInteger ::=
	"*"
	Integer
Name ::=
	ListModId Ident
LExp ::=
	LExp "<=>" LExp1
	LExp1
LExp1 ::=
	LExp1 "=>" LExp2
	LExp1 "=>" LExp2 "else" LExp2
	LExp2
LExp2 ::=
	LExp2 "||" LExp3
	LExp3
LExp3 ::=
	LExp3 "xor" LExp4
	LExp4
LExp4 ::=
	LExp4 "&&" LExp5
	LExp5
LExp5 ::=
	"~" LExp6
	LExp6
LExp6 ::=
	Term
	"(" LExp ")"
Term ::=
	CmpExp
	SExp
	Quant SExp
	ListDecl "|" LExp
CmpExp ::=
	Exp "<" Exp
	Exp ">" Exp
	Exp "=" Exp
	Exp "==" Exp
	Exp "<=" Exp
	Exp ">=" Exp
	Exp "!=" Exp
	Exp "/=" Exp
	Exp "in" Exp
	Exp "not" "in" Exp
Exp ::=
	AExp
	StrExp
Quant ::=
	"no"
	"lone"
	"one"
	"some"
ExQuant ::=
	"all"
	Quant
SExp ::=
	SExp "++" SExp1
	SExp1
SExp1 ::=
	SExp1 "&" SExp2
	SExp2
SExp2 ::=
	SExp2 "<:" SExp3
	SExp3
SExp3 ::=
	SExp3 ":>" SExp4
	SExp4
SExp4 ::=
	SExp4 "." SExp5
	SExp5
SExp5 ::=
	Ident
	"(" SExp ")"
Decl ::=
	ExQuant "disj"? ListLocId ":" SExp
AExp ::=
	AExp "+" AExp1
	AExp "−" AExp1
	AExp1
AExp1 ::=
	AExp1 "*" AExp2
	AExp2
AExp2 ::=
	"#" SExp
	SExp
	Integer
	"(" AExp ")"
StrExp ::=
	StrExp "++" StrExp
	String
EnumId ::=
	Ident
ModId ::=
	Ident
LocId ::=
	Ident
ListDeclaration ::=
	Declaration*
ListEnumId ::=
	(EnumId "|")* EnumId
ListElement ::=
	Element*
ListLExp ::=
	LExp*
ListDecl ::=
	(Decl ",")* Decl
ListLocId ::=
	(LocId ",")* LocId
ListModId ::=
	(ModId "/")*

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