Skip to content

Grammar

FoelliX edited this page Nov 25, 2021 · 4 revisions

AQL-Question Grammar

The grammar on this page was not updated after version 1.2.0.
The up-to-date grammar can be found in the JavaCC grammar file: QuestionGrammar.jj


G = (T, N, P, S)

(Non-)Terminals & Startsymbol

TFromTo = {"Flows"}
TIn = {"Permissions", "IntentSources", "IntentSinks", "IntentFilters", "Intents"}
Top1 = { "UNIFY", "CONNECT" }
Top2 = { "FILTER" }
T = TFromTo ∪ TIn ∪ Top1 ∪ Top2
{"?", "!", "'", "FROM", "TO", "IN", "FEATURING", "USES", "->", "(", ")", "[", "]", "∣", "=", "Statement", "Method", "Class", "App"} ∪
{w ∣ w = ( any symbol except " ' ")+ }
N = {❬answer❭,❬element❭, ❬features❭, ❬feature❭, ❬fromTo❭, ❬in❭, ❬operator❭, ❬operators1❭, ❬operators2❭, ❬query❭, ❬question❭, ❬reference❭, ❬string❭, ❬soi❭, ❬soiFromTo❭, ❬soiIn❭, ❬uses❭, ❬use❭}
S = ❬query❭

Production Rules

P = {
p1: ❬query❭ ::= ❬element❭+ ,
p2: ❬element❭ ::= ❬question❭ ("FEATURING" ❬features❭)? ("USES" ❬uses❭)? "?" ∣ ❬answer❭ "!" ∣ ❬operator❭,
p3: ❬question❭ ::= (❬soiFromTo❭ (❬fromTo❭ ∣ ❬in❭))
∣ (❬soIn❭ ❬in❭),
p4: ❬features❭ ::= ❬feature❭ ("," ❬feature❭)*,
p5: ❬feature❭ ::= ❬string❭,
p6: ❬uses❭ ::= ❬use❭ ("," ❬use❭)*,
p7: ❬use❭ ::= ❬string❭,
p8: ❬answer❭ ::= ❬string❭,
p9: ❬operator❭ ::= (❬operators1❭ "[" ❬element❭ (","❬element❭)* "]")
∣ (❬operators2❭ "[" ❬element❭
    ("∣" ❬string❭ "=" ❬string❭)?
    ("∣" ❬soi❭)?
"]"),
p10: ❬fromTo❭ ::= "FROM" ❬reference❭ "TO" ❬reference❭,
p11: ❬in❭ ::= "IN" ❬reference❭,
p12: ❬reference❭ ::=
("Statement" "(" ❬string❭ ")" "->")?
("Method" "(" ❬string❭ ")" "->")?
("Class" "(" ❬string❭ ")" "->")?
("App" "(" ❬string❭ ("∣" ❬string❭)? ")",
p13: ❬operators1❭ ::= {w ∣ w ∈ Top1 },
p14: ❬operators2❭ ::= {w ∣ w ∈ Top2 },
p15: ❬soi❭ ::= ❬soiFromTo❭ ∣ ❬soiIn❭,
p16: ❬soiFromTo❭ ::= {w ∣ w ∈ TFromTo },
p17: ❬soiIn❭ ::= {w ∣ w ∈ TIn },
p18: ❬string❭ ::= "'" ( any symbol except "'")+ "'"
}