BNF for dawg.jj
NON-TERMINALS
CompilationUnit
::=
Query
<EOF>
CommaOpt
::=
( <COMMA> )?
Query
::=
(
PrefixDecl
)* (
SelectClause
|
ConstructClause
|
DescribeClause
|
AskClause
) (
PrefixDecl
)* (
FromClause
)? ( <WHERE>
GraphPattern
)?
SelectClause
::=
( <SELECT>
VarAsNode
(
CommaOpt
VarAsNode
)* | <SELECT> <STAR> )
DescribeClause
::=
( <DESCRIBE>
VarOrURI
(
CommaOpt
VarOrURI
)* | <DESCRIBE> <STAR> )
ConstructClause
::=
( <CONSTRUCT>
ConstructPattern
| <CONSTRUCT> <STAR> )
ConstructPattern
::=
TriplePatternList
AskClause
::=
<ASK>
FromClause
::=
<FROM>
FromSelector
(
CommaOpt
FromSelector
)*
FromSelector
::=
URL
GraphPattern
::=
PatternGroup
SourceGraphPattern
::=
( <SOURCE> <STAR>
PatternGroup1
| <SOURCE>
VarOrURI
PatternGroup1
)
OptionalGraphPattern
::=
( <OPTIONAL>
PatternGroup1
| <LBRACKET>
PatternGroup
<RBRACKET> )
PatternGroup
::=
PatternElement
(
PatternElement
)*
PatternElement
::=
(
TriplePatternList
|
ExplicitGroup
|
PatternElementForms
)
PatternGroup1
::=
PatternElement1
PatternElement1
::=
(
SingleTriplePatternOrGroup
|
PatternElementForms
)
PatternElementForms
::=
(
SourceGraphPattern
|
OptionalGraphPattern
| <AND>
Expression
)
SingleTriplePatternOrGroup
::=
(
TriplePattern
|
ExplicitGroup
)
ExplicitGroup
::=
<LPAREN>
PatternGroup
<RPAREN>
TriplePatternList
::=
TriplePattern
(
TriplePattern
)*
TriplePattern
::=
<LPAREN>
VarOrURI
VarOrURI
VarOrLiteral
<RPAREN>
VarOrURI
::=
(
VarAsNode
|
URI
)
VarOrLiteral
::=
(
VarAsNode
|
Literal
)
VarAsNode
::=
<VAR>
VarAsExpr
::=
<VAR>
PrefixDecl
::=
( <PREFIX> <NCNAME> <COLON>
QuotedURI
| <PREFIX> <COLON>
QuotedURI
)
Expression
::=
ConditionalOrExpression
ConditionalOrExpression
::=
ConditionalXorExpression
( <SC_OR>
ConditionalXorExpression
)*
ConditionalXorExpression
::=
ConditionalAndExpression
ConditionalAndExpression
::=
ValueLogical
( <SC_AND>
ValueLogical
)*
ValueLogical
::=
StringEqualityExpression
StringEqualityExpression
::=
NumericalLogical
( <STR_EQ>
NumericalLogical
| <STR_NE>
NumericalLogical
| <STR_MATCH>
PatternLiteral
| <STR_NMATCH>
PatternLiteral
)*
NumericalLogical
::=
EqualityExpression
EqualityExpression
::=
RelationalExpression
( <EQ>
RelationalExpression
| <NEQ>
RelationalExpression
)?
RelationalExpression
::=
NumericExpression
( <LT>
NumericExpression
| <GT>
NumericExpression
| <LE>
NumericExpression
| <GE>
NumericExpression
)?
NumericExpression
::=
ShiftExpression
ShiftExpression
::=
AdditiveExpression
AdditiveExpression
::=
MultiplicativeExpression
( <PLUS>
MultiplicativeExpression
| <MINUS>
MultiplicativeExpression
)*
MultiplicativeExpression
::=
UnaryExpression
( <STAR>
UnaryExpression
| <SLASH>
UnaryExpression
| <REM>
UnaryExpression
)*
UnaryExpression
::=
( <PLUS>
UnaryExpressionNotPlusMinus
| <MINUS>
UnaryExpressionNotPlusMinus
|
UnaryExpressionNotPlusMinus
)
UnaryExpressionNotPlusMinus
::=
( <TILDE> | <BANG> )
UnaryExpression
|
PrimaryExpression
PrimaryExpression
::=
(
VarAsExpr
|
Literal
|
FunctionCall
| <LPAREN>
Expression
<RPAREN> )
FunctionCall
::=
<AMP> <QNAME> <LPAREN>
ArgList
<RPAREN>
ArgList
::=
(
VarOrLiteral
( <COMMA>
VarOrLiteral
)* )?
Literal
::=
URI
|
NumericLiteral
|
TextLiteral
NumericLiteral
::=
<INTEGER_LITERAL>
|
<FLOATING_POINT_LITERAL>
TextLiteral
::=
( <STRING_LITERAL1> | <STRING_LITERAL2> ) ( <LANG> )? ( <DATATYPE>
URI
)?
PatternLiteral
::=
URL
::=
URI
URI
::=
QuotedURI
|
QName
QName
::=
<QNAME>
QuotedURI
::=
<URI>