CDL Formal Grammar

This appendix provides a programmer’s reference of CDL syntax.

This appendix covers the following topics:

Notation Used in Presenting CDL Grammar

The notation used in this appendix to present the lexical grammar of CDL follows the Extended Backus-Naur Form (EBNF) symbols. The table Notation Used in Presenting CDL Grammar (EBNF) lists the symbols used in presenting CDL Grammar using EBNF, and provides a description of each. The symbols help you read this appendix.

Notation Used in Presenting CDL Grammar (EBNF)
Symbol Description
| A vertical bar separates alternatives within brackets, braces, or alternative productions.
[] Square brackets enclose optional items.
{} Braces enclose repetition.
* An asterisk shows that the preceding element can be repeated 0 or more times.
+ A plus shows that the preceding element can be repeated 1 or more times.
? A question mark shows that the preceding element can be repeated 0 or 1 times.
- A minus shows that the trailing element has been excluded from the preceding element.
: A colon shows assignment of the production(s) that follow, separated by a vertical bar (|) if multiple.
::= In Nonterminal Symbols, a doubled colon followed by an equals sign shows assignment of the production(s) that follow.
# In EBNF Source Code Definitions for CDL Terminal Symbols, a pound sign shows that a symbol name is private to the set of terminal symbols.
< > Angle brackets enclose the name of a terminal symbol. In EBNF Source Code Definitions for CDL Terminal Symbols, angle brackets also enclose the definition of a terminal symbol.
TERMINAL Terminal symbols represent the names, characters, or literal strings of tokens. Quoted upper case is used for terminal symbols. CONSTRAIN and WHERE are examples of terminal symbols.
NonTerminal Nonterminal symbols represent the names of grammar rules. Unquoted mixed case is used for non-terminals. ConstrainingExpression and BooleanExpression are examples of nonterminal symbols.

The grammar presented in this appendix includes productions containing a nonterminal symbol followed by a sequence of terminal or nonterminal symbols. Alternative sequences start with a vertical bar. For an explanation of syntax typographical conventions and symbols, see also Syntax Notation.

Examples of Notation Used in Presenting CDL Grammar

This section provides examples of the use of the notation described in Notation Used in Presenting CDL Grammar (EBNF). You can use it to interpret the definitions provided in Terminal Symbols and Nonterminal Symbols.

Example 1

The following definition is from Keyword Symbols:

CONSTRAIN
: "CONSTRAIN"

This definition means that the terminal symbol CONSTRAIN is defined as the character string CONSTRAIN.

Example 2

The following definition is from Literal Symbols:

INTEGER_LITERAL
: "0" | <NONZERO_DIGIT> ( <DIGIT> )* 

This definition means that the terminal symbol INTEGER_LITERAL is defined as:

Example 3

The following definition is from Nonterminal Symbols:

Constraint 
::= ( <CONSTRAIN> )? ConstrainingExpression 

This definition means that the nonterminal symbol Constraint is defined as 0 or 1 occurrences of the symbol CONSTRAIN followed by the symbol ConstrainingExpression .

Terminal Symbols

This section summarizes the terminal symbols (lexical productions) for CDL, in the form of EBNF. For your convenience in using this section, the names of symbols referenced in another symbols or rule are cross-references linked to their definitions. For example, the cross-reference link CONSTRAIN is used in some rules; in that rule you can use the link to jump to the definition of the symbol CONSTRAIN.

The format of the EBNF coding in this section has been edited slightly for easier reading. To examine the precise set of terminal symbol definitions, see EBNF Source Code Definitions for CDL Terminal Symbols.

See Notation Used in Presenting CDL Grammar (EBNF) for information on the notation used in this section.

Keyword Symbols

See Keywords for an explanation of this topic.

EBNF for Keyword Symbols

CONSTRAIN
: "CONSTRAIN"
CONTRIBUTE
: "CONTRIBUTE"
COMPATIBLE
: "COMPATIBLE" 
OF
: "OF"
FORALL
: "FOR ALL"
IN
: "IN"
WHERE
: "WHERE"
COLLECT
: "COLLECT"
DISTINCT
: "DISTINCT" 
WHEN
: "WHEN"
WITH
: "WITH"
TO
: "TO"
REQUIRES
: "REQUIRES"
IMPLIES
: "IMPLIES"
EXCLUDES
: "EXCLUDES"
NEGATES
: "NEGATES"
DEFAULTS
: "DEFAULTS"
FUNC_PTR
: "@"
 

Operator Symbols

See Operators for an explanation of this topic.

EBNF for Operator Symbols

PLUS
: "+" 
MINUS
: "-" 
MULTIPLY
: "*" 
DIVIDE
: "/" 
ZDIV
: "ZDIV" 
MOD
: "%" 
EXP
: "^" 
EQUALS
: "=" 
NOT_EQUALS
: "<>" 
GT
: ">" 
GE
: ">=" 
LT
: "<" 
LE
: "<=" 
NOT
: "NOT" 

NOTTRUE
: "NOTTRUE" 
AND
: "AND" 
OR
:  "OR" 
LIKE
: "LIKE" 
NOT_LIKE
: "NOT LIKE" 
 

Literal Symbols

See Literals for an explanation of this topic. Escaped Characters Inside Double Quotes describes the values of TEXT_LITERAL.

EBNF for Literal Symbols

 
END
: "\\0" 
DIGITS
: ( <DIGIT> )+ 
DIGIT
: "0" | <NONZERO_DIGIT> 
NONZERO_DIGIT
: ["1"-"9"] 
TEXT_LITERAL
: "\"" ( ~["\"","\\","\n","\r"] 
| "\\" ["n","t","b","r","f","\\","\""] 
)* "\"" 
INTEGER_LITERAL
: "0" | <NONZERO_DIGIT> ( <DIGIT> )* 
DECIMAL_LITERAL
: ( <INTEGER_LITERAL> "." ( <DIGITS> )? ( <EXPONENTIAL> )?
| <INTEGER_LITERAL> <EXPONENTIAL>
| "." <DIGITS> ( <EXPONENTIAL> )?
| "PI"
| "E"
) 
EXPONENTIAL
: "E" ( <PLUS> | <MINUS> )? <INTEGER_LITERAL> 
BOOLEAN_LITERAL
: "TRUE" 
| "FALSE" 
 

Separator Symbols

See Separators for an explanation of this topic.

EBNF for Separator Symbols

DOT
: "."
COMMA
: ","
SEMICOLON
: ";"
LPAREN
: "("
RPAREN
: ")"
LBRACKET
: "{"
RBRACKET
: "}"
 

Identifier Symbols

See the following sections for an explanation of this topic:

Values for Unicode Escapes Allowed in Identifiers lists the character values for the Unicode escapes that are allowed in the LETTER symbol. The columns are Unicode and Character.

Values for Unicode Escapes Allowed in Identifiers
Unicode Character
"\u0024" $ (dollar sign)
"\u0041"-"\u005a" A through Z
"\u005f" _ (underscore)
"\u0061"-"\u007a" a through z
"\u00c0"-"\u00d6" Latin Capital Letter A With Grave through Latin Capital Letter O With Diaeresis
"\u00d8"-"\u00f6" Latin Capital Letter O With Stroke through Latin Small Letter O With Diaeresis
"\u00f8"-"\u00ff" Latin Small Letter O With Stroke through Latin Small Letter Y With Diaeresis
"\u0100"-"\u1fff" Latin Capital Letter A With Macron through Greek Dasia
"\u3040"-"\u318f" Hiragana Letter Small A through Hangul Letter Araeae
"\u3300"-"\u337f" Square Apaato through Square Corporation
"\u3400"-"\u3d2d" CJK Unified Ideographs
"\u4e00"-"\u9fff" CJK Unified Ideographs
"\uf900"-"\ufaff" CJK Compatibility Ideographs

EBNF for Identifier Symbols

 
USER_PROP_IDENTIFIER
: "property" 
SIMPLE_IDENTIFIER
: <LETTER> ( <LETTER_OR_DIGIT> )* 
FORMAL_IDENTIFIER
: "&" <LETTER> ( <LETTER_OR_DIGIT> )* 
QUOTED_IDENTIFIER
: "'" ( ~["\'"] | "\\'")* "'" 
LETTER
: ["\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a",
   "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff",
   "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f",
   "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff"]
LETTER_OR_DIGIT
: <LETTER> | <DIGIT> | ( "\\" ( "\"" | "\'" | "\\" ) | "\'" ) >
 

Comment Symbols

See Comments for an explanation of this topic.

EBNF for Comment Symbols

"//" 
: IN_SINGLE_LINE_COMMENT
"--" 
: IN_SINGLE_LINE_COMMENT
"/*" 
: IN_MULTI_LINE_COMMENT
IN_SINGLE_LINE_COMMENT
:
<SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : DEFAULT
IN_MULTI_LINE_COMMENT
:
< : "*/" > : DEFAULT
IN_SINGLE_LINE_COMMENT,IN_MULTI_LINE_COMMENT
:
  < ~[] >

Whitespace Symbols

See Whitespace and Line Terminators for an explanation of this topic.

EBNF for Whitespace Symbols

WHITESPACE
: ( " " | "\t" | "\f" | <LINE_BREAK> )+ 
LINE_BREAK
: "\n" | "\r" | "\r\n"

Nonterminal Symbols

This section summarizes the nonterminal symbols for CDL, in the form of EBNF. For your convenience in using this section, the names of symbols referenced in another symbols or rule are cross-references linked to their definitions. For example, the cross-reference link Expression is used in some rules; in that rule you can use the link to jump to the definition of the symbol Expression.

See Notation Used in Presenting CDL Grammar (EBNF) for information on the notation used in this section.

Important: There are new symbols available for CDL when using the Fusion Configurator Engine (FCE). The FCE is an alternative to the configuration engine described in this document. For all information about CDL with the FCE, see the Oracle Configurator Fusion Configurator Engine Guide.

EBNF for Nonterminal Symbols

Statements 
::= ( ( Statement )? ) ( ";" ( Statement )? )* ( <END> | <EOF> )
 
Statement 
::= ( Constraint | Contribute | Compatible )
 
Constraint 
::= ( <CONSTRAIN> )? ConstrainingExpression
 
ConstrainingExpression 
::= ( Expression ( ( ConstrainingOperator Expression ) ( ForAll )? )? )
 
ConstrainingOperator 
::= ( <REQUIRES> | <IMPLIES> | <EXCLUDES> | <NEGATES> | <DEFAULTS> )
 
Contribute 
::= ( <CONTRIBUTE> Expression <TO> Reference ) ( ForAll )?
 
Compatible 
::= ( <COMPATIBLE> ( <FORMAL_IDENTIFIER> <OF> Reference ) ( ( "," <FORMAL_IDENTIFIER> <OF> Reference ) )+ Where )
 
Method 
::= ( <SIMPLE_IDENTIFIER> Arguments )
 
Event
::= ( <SIMPLE_IDENTIFIER> ( ":" <TEXT_LITERAL> )? )
 
EventScope
::= ( <SIMPLE_IDENTIFIER> )
 
ForAll
::= ( <FORALL> Iterator ( "," Iterator )* ( Where )? )
 
Where
::= ( <WHERE> Expression )
 
Iterator
::= ( <FORMAL_IDENTIFIER> <IN> ( CollectionExpression | CollectionLiteral | Function | Reference ) )
 
Expression
::= OrExpression
 
OrExpression
::= ( AndExpression ( <OR> OrExpression )? )
 
AndExpression
::= ( EqualityExpression ( <AND> AndExpression )? )
 
EqualityExpression
::= ( RelationalExpression ( ( <EQUALS> | <NOT_EQUALS> | <LIKE> | <NOT_LIKE> ) EqualityExpression )? )
 
RelationalExpression
::= ( AdditiveExpression ( ( <GT> | <GE> | <LT> | <LE> ) RelationalExpression )? )
 
AdditiveExpression
::= ( MultiplicativeExpression ( ( ( <PLUS> | <MINUS> ) AdditiveExpression ) )? )
 
MultiplicativeExpression
::= ( UnaryExpression ( ( ( <MULTIPLY> | <DIVIDE> | <ZDIV> | <MOD> ) MultiplicativeExpression ) )? )
 
UnaryExpression
::= ( ( ( ( <PLUS> | <MINUS> | <NOT> | <NOTTRUE> ) )? ExponentExpression ) )
 
ExponentExpression
::= ( PrimaryExpression ( "^" ExponentExpression )? )
 
PrimaryExpression
::= ( CollectionExpression | Literal | "(" Expression ")" | Function | Reference )
 
CollectionExpression
::= "{" "COLLECT" ( ( <DISTINCT> ) )? Expression ForAll "}"
 
Literal
::= ( ( <INTEGER_LITERAL> ) | ( <DECIMAL_LITERAL> ) | ( <BOOLEAN_LITERAL> ) | ( <TEXT_LITERAL> ) | CollectionLiteral )
 
Arguments
::= "(" ( ExpressionList )? ")"
 
ExpressionList
::= ExpressionElement ( "," ExpressionElement )*
 
ExpressionElement
::= ( ( <FUNC_PTR> ( FunctionName | AnyOperator ) ) | Expression )
 
CollectionLiteral
::= "{" ( ExpressionList )? "}"
 
Function
::= ( FunctionName Arguments )
See Functions for a list of available functions.
Reference
::= ( ( ModelIdentifier ( <DOT> ModelIdentifier )* ( <DOT> SysPropIdentifier )* ( <DOT> UserPropIdentifier )? ) | ( ArgumentIdentifier ( <DOT> SysPropIdentifier )* ( <DOT> UserPropIdentifier )? ) )
 
UserPropIdentifier
::= ( <USER_PROP_IDENTIFIER> "(" <TEXT_LITERAL> ")" )
 
SysPropIdentifier
::= ( <SIMPLE_IDENTIFIER> Arguments )
 
ModelIdentifier
::= ( ( <SIMPLE_IDENTIFIER> | <QUOTED_IDENTIFIER> ) )
 
ArgumentIdentifier
::= <FORMAL_IDENTIFIER> 
 
FunctionName
::= ( <SIMPLE_IDENTIFIER> | <FORMAL_IDENTIFIER> | <QUOTED_IDENTIFIER> )
 
AnyOperator
::= ( ConstrainingOperator  | <CONTRIBUTE> | <COMPATIBLE> | <PLUS> | <MINUS> | <MULTIPLY> | <DIVIDE> | <ZDIV> | <MOD> | <EXP> | <EQUALS> | <NOT_EQUALS> | <GT> | <GE> | <LT> | <LE> | <NOT> | <NOTTRUE> | <AND> | <OR> | <LIKE> | <NOT_LIKE> )

EBNF Source Code Definitions for CDL Terminal Symbols

This section provides the precise set of definitions for the terminal symbols of CDL, taken directly from the defining source code. For a version of these definitions that is edited slightly for easier reading, see Terminal Symbols.

EBNF Source Code for Terminal Symbols

SPECIAL_TOKEN : /* whitespace */
{ 
  < WHITESPACE: ( " " | "\t" | "\f" | <LINE_BREAK> )+ >
| < LINE_BREAK: "\n" | "\r" | "\r\n" >}
 
 
MORE : /* comments */{
 
  "//" : IN_SINGLE_LINE_COMMENT
| "--" : IN_SINGLE_LINE_COMMENT
| "/*" : IN_MULTI_LINE_COMMENT}
 
<IN_SINGLE_LINE_COMMENT>
SPECIAL_TOKEN :{
 
  <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : DEFAULT}
 
<IN_MULTI_LINE_COMMENT>
SPECIAL_TOKEN :{
 
  <MULTI_LINE_COMMENT: "*/" > : DEFAULT}
 
<IN_SINGLE_LINE_COMMENT,IN_MULTI_LINE_COMMENT>
MORE :{
 
  < ~[] >}
 
 
TOKEN : /* literals */{ < END: "\\0" >
| < #DIGITS: ( <DIGIT> )+ >
| < #DIGIT: "0" | <NONZERO_DIGIT> >
| < #NONZERO_DIGIT: ["1"-"9"] >
| < TEXT_LITERAL: "\"" ( ~["\"","\\","\n","\r"] 
                       | "\\" ["n","t","b","r","f","\\","\""] 
                       )* "\"" >

| < INTEGER_LITERAL: "0" | <NONZERO_DIGIT> ( <DIGIT> )* >
| < DECIMAL_LITERAL: ( <INTEGER_LITERAL> "." ( <DIGITS> )? ( <EXPONENTIAL> )?
                     | <INTEGER_LITERAL> <EXPONENTIAL>
                     | "." <DIGITS> ( <EXPONENTIAL> )?
                     | "PI"
                     | "E"
                     ) >
| < #EXPONENTIAL: "E" ( <PLUS> | <MINUS> )? <INTEGER_LITERAL> >
| < BOOLEAN_LITERAL: "TRUE" | "FALSE" >}
 
 
TOKEN : /* operators */{
  < PLUS: "+" >
| < MINUS: "-" >
| < MULTIPLY: "*" >
| < DIVIDE: "/" >
| < ZDIV: "ZDIV" >
| < MOD: "%" >
| < EXP: "^" >
| < EQUALS: "=" >
| < NOT_EQUALS: "<>" >
| < GT: ">" >
| < GE: ">=" >
| < LT: "<" >
| < LE: "<=" >
| < NOT: "NOT" >
| < NOTTRUE: "NOTTRUE" >
| < AND: "AND" >
| < OR:  "OR" >
| < LIKE: "LIKE" >}
 
 
TOKEN : /* keywords */{
  < CONSTRAIN: "CONSTRAIN" >
| < CONTRIBUTE: "CONTRIBUTE" >
| < COMPATIBLE: "COMPATIBLE" > 
| < OF: "OF" >
| < FORALL: "FOR ALL" >
| < IN: "IN">
| < WHERE: "WHERE" >
| < COLLECT: "COLLECT" >
| < DISTINCT: "DISTINCT" > 
| < WHEN: "WHEN" >
| < WITH: "WITH" >
| < TO: "TO" >
| < REQUIRES: "REQUIRES" >
| < IMPLIES: "IMPLIES" >
| < EXCLUDES: "EXCLUDES" >
| < NEGATES: "NEGATES" >
| < DEFAULTS: "DEFAULTS" >
| < FUNC_PTR: "@" >
}
 
 
TOKEN : /* separators */{
  < DOT: "." >
| < COMMA: "," >
| < SEMICOLON: ";" >
| < LPAREN: "(" >
| < RPAREN: ")" >
| < LBRACKET: "{" >
| < RBRACKET: "}" >}
 
 
TOKEN : /* identifiers */{
 
  < USER_PROP_IDENTIFIER: "property" >
| < SIMPLE_IDENTIFIER: <LETTER> ( <LETTER_OR_DIGIT> )* >
| < FORMAL_IDENTIFIER: "&" <LETTER> ( <LETTER_OR_DIGIT> )* >
| < QUOTED_IDENTIFIER: "'" ( ~["\'"] | "\\'")* "'" > 
| < #LETTER: ["\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a",
              "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff",
              "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f",
              "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff"] >
| < #LETTER_OR_DIGIT: <LETTER> | <DIGIT> | ( "\\" ( "\"" | "\'" | "\\" ) | "\'" ) >}