/*******************************************************************************
 * Copyright (c) 2011 FernUniversitaet in Hagen
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    yourName -- initial implementation
 ******************************************************************************/

/*
 * Refacola Language Definition
 */
language Eiffel

kinds
	Class <: DeclaredEntity
	abstract DeclaredEntity <: ENTITY { identifier }
	Export <: ENTITY { accessibility }
	Feature <: Variable { inheritedId, accessibility }
	Local <: Variable
	Formal <: Local
	
	abstract Variable <: DeclaredEntity { referencedType, location }
	
	Reference <: REFERENCE { identifier, location, referencedType }
	FeatureReference <: Reference { referencedFeature }
	LocalReference <: Reference { referencedLocal }

properties
	accessibility "\\alpha": EiffelType
	identifier "\\iota": Identifier
	inheritedId "\\nu": Identifier
	location "\\lambda": EiffelType
	referencedType "\\tau": EiffelType
	referencedFeature: EiffelFeature
	localFeature: EiffelFeature
	inheritedFeature: EiffelFeature
	referencedLocal: EiffelLocal

domains
	EiffelType = [ Class ]
	EiffelFeature = [ Feature ]
	EiffelLocal = [ Local ]

queries
	accesses(r: Reference, d: DeclaredEntity)
			"Reference accesses DeclaredEntity from other class"
	assignment(left: Reference, right: Reference)
			"2nd Reference is assigned to the 1st"
	binds(r: Reference, d: DeclaredEntity) "Reference binds to DeclaredEntity"
	create(r: Reference)
			"object of Reference's type is created and assigned to it"
	current(r: Reference) "Reference is Current"
	defines(c: Class, f: Feature) "Feature is (re)defined or renamed in Class"
	feature(e: Export, f: Feature) "Feature is a feature of the clause Export"
	has(c: Class, d: DeclaredEntity) "Class defines or inherits Feature or Local"
	immediate(f: Feature, c: Class) "Feature is immediate in Class." // Testing purpose.
	inherits(sub: Class, sup: Class) "1st Class inherits from 2nd"
	parent(sub: Class, sup: Class) "2nd Class is parent from 1st"
	like(declared: Variable, template: Variable)
			"1st Variable declared to have the type of 2nd"
	redefines(redefining: Feature, redefined: Feature) "1st Feature redefines 2nd"
	reexports(f1: Feature, f2: Feature)
			"1st Feature redefines export status of 2nd"
	renames(r: Feature, f: Feature)
			"Renaming renames inherited Feature, poss. default"
	requires(f1: Feature, f2: Feature)
			"1st Feature references 2nd Feature in its precondition"
	result(r: Reference, query: Feature) "Reference is Result of query Feature"
	seed(f: Feature, seed: Feature)
			"2nd Feature is seed (root definition) of 1st Feature"
	target(selector: Reference, receiver: Reference)
			"2nd Reference is the target (receiver) of 1st"
	actual(actual: Reference, r: Reference, index: INDEX)
			"1st Ref. is actual of 2nd Ref. at Index"
	formal(formal: Local, feature: Feature, index: INDEX)
			"Formal is formal of Feature at Index"
	merging(r1: Feature, r2: Feature)
			"Features are merged in immediate subclass"
	split(r1: Feature, r2: Feature)
			"Features are different feat. in immediate subclass"