module ::= package ( import )* policy package ::= "package" ref import ::= "import" package ( "as" var )? policy ::= ( rule )* rule ::= ( "default" )? rule-head ( rule-body )* rule-head ::= var ( "(" rule-args ")" )? ( "[" term "]" )? ( ( ":=" | "=" ) term )? rule-args ::= term ( "," term )* rule-body ::= ( "else" ( "=" term )? )? "{" query "}" query ::= literal ( ( ";" | ( ( CR )? LF ) ) literal )* literal ::= ( some-decl | expr | "not" expr ) ( with-modifier )* with-modifier ::= "with" term "as" term some-decl ::= "some" var ( "," var )* expr ::= term | expr-call | expr-infix expr-call ::= var ( "." var )? "(" ( term ( "," term )* )? ")" expr-infix ::= ( term "=" )? term infix-operator term term ::= ref | var | scalar | array | object | set | array-compr | object-compr | set-compr array-compr ::= "[" term "|" rule-body "]" set-compr ::= "{" term "|" rule-body "}" object-compr ::= "{" object-item "|" rule-body "}" infix-operator ::= bool-operator | arith-operator | bin-operator bool-operator ::= "==" | "!=" | "<" | ">" | ">=" | "<=" arith-operator ::= "+" | "-" | "*" | "/" bin-operator ::= "&" | "|" ref ::= ( var | array | object | set | array-compr | object-compr | set-compr | expr-call ) ( ref-arg )* ref-arg ::= ref-arg-dot | ref-arg-brack ref-arg-brack ::= "[" ( scalar | var | array | object | set | "_" ) "]" ref-arg-dot ::= "." var var ::= ( ALPHA | "_" ) ( ALPHA | DIGIT | "_" )* scalar ::= string | NUMBER | TRUE | FALSE | NULL string ::= STRING | raw-string raw-string ::= "`" (CHAR - '`')* "`" array ::= "[" term ( "," term )* "]" object ::= "{" object-item ( "," object-item )* "}" object-item ::= ( scalar | ref | var ) ":" term set ::= empty-set | non-empty-set non-empty-set ::= "{" term ( "," term )* "}" empty-set ::= "set(" ")"