-
Notifications
You must be signed in to change notification settings - Fork 4
schema language
This is a draft page filled as we go with the language implementation. The
ultimate source of truth for the syntax is schema.bnf
.
Epigraph schema files have an .epigraph
extension and consist of a namespace
declaration followed by imports followed by type and resource declarations.
Namespace declaration is mandatory and consists of a namespace
keyword
followed by a fully-qualified namespace. Fully-qualified namespace is a list of
dot-separated namespace names forming a hierarchy, similar to Java packages.
Namespace names must be lower-cased.
Namespaces are used to organize types and resources into logical groups. They may also be translated by the code generators into appropriate language constructs such as packages.
#Imports There are two kinds of imports: namespace imports and single type imports.
Single type import makes one single type from another package available:
import foo.bar.Baz
record R {
myField: Baz
}
Importing types with the same short name from different namespaces is not allowed:
import foo.bar.Baz
import qux.Baz // clash!
Namespace import brings given namespace into the scope, so that namespace prefix can be omitted:
import foo.bar
record R {
myField: bar.Baz
}
Importing namespaces with the same last segment is not allowed:
import foo.bar
import qux.bar // clash!
The following imports are always implicitly present:
import epigraph.String
import epigraph.Integer
import epigraph.Long
import epigraph.Double
import epigraph.Boolean
Type references are resolved in the following order:
- Using explicit imports
- Using implicit (standard) imports
- Types from the same (current) namespace
See [References implementation](References implementation) for more technical details.
Type A
inherits type B
if they are of the same kind and one of the following
is true:
-
A
extendsB
-
B
supplementsA
A
is a member of a vartypeV
andB
supplementsV
-
A
inheritsT
, andT
inheritsB
(transitivity)