Extended BNF grammar for FCG

"?" means 0 or 1 times, "*" means 0 to N times, "+" means 1 to N times) FCG := "~"? "[" Concept Branches? "]" Context? Context := "(" Branch Branches? ")" Branches := ("," Branch)+ Branch := Path_specif? Relation Concept Path_specif := Path_term ("|" Path_term)* Path_term := Path_factor Path_factor* Path_factor := "(" Relation Concept? ")" Count | "(" Path_specif ")" Count Count := "?" | "*" | Number? "+" | Number Relation := (RelationType|Coreference) "of"? Annotation? Context? ("#"?":" | "<=") | ("=>" | "<=>" | "<=" ) Concept | ("=" | "!=" | "<" | "=<" | ">" | ">=" ) Concept | "?" ":" RelationType := Term_or_string Coreference := "*" Term_or_number Concept := ConceptCore Annotation? | "(" ConceptCore Annotation? Branches? ")" ConceptCore := CorefOrIndiv Quantifier Restrictor CQ? | Quantifier Restrictor CorefOrIndiv? CQ? | GroupOf Quantifier? Restrictor CorefDecl? (Collection|"?")? | GroupOf Quantifier? CorefDecl? Collection | (Number | "~"Coreference | CQ | CorefOrIndiv CQ?) CorefOrIndiv := CorefDecl | "named"? Term_or_string ("\\" ConceptType)? //Term_or_string: individual (ex: Tom) or attribute (ex: high) CorefDecl := "*"Term_or_number | "*"Term_or_number "!=" "*"Term_or_number | "*"Term_or_number "!=" Term_or_number CQ := Collection | FCG | "?" Restrictor := Qualifier? ConceptType | Qualifier? "(" ConceptType Branches ")" ConceptType := Term_or_string Qualifier := "good"|"bad" | "important"|"small"|"big"|"great" | "certain" Quantifier := "a" | "an" | "some" | "the" | "any" | "every" | "most" "of"? "the"? | "at" "least" Number "%"? "of"? "the"? | "at" "most" Number "%"? "of"? "the"? | "between" Number "%"? "and" Number "%"? "of"? "the"? | Number "to" Number "%"? "of"? "the"? | "from" Number "to" Number "%"? "of"? "the"? | "mostly" | "several" "of"? "the"? | Number "%"? "of"? "the"? | ("many"|"few"|"dozens"|"hundreds" |"thousands"|"millions"|"billions") "of"? "the"? GroupOf := CorefOrIndiv?("a"|"the")("group""of" | "bag""of" | "set""of"|"sequence""of"|"alternative") | "together" Collection := "{" (Set|Bag|OrderedSet|OrderedBag|XOR_Set|OR_Bag) "}" CollSize? Set := Element ("," Element)* Bag := Element ("&" Element)* OrderedSet := Element ("<" Element)* OrderedBag := Element ("=<" Element)* XOR_Set := Element ("/" Element)* OR_Bag := Element ("|" Element)* Element := Concept | "*" CollSize := "@" Number Term_or_number:= Term | number Term_or_string:= Term | string Term := TermLetter1 TermLetter* TermLetter1 := [a-z] | "#"[a-z] TermLetter := [a-z] | "#" | "_" | "-" | "/" | "?" | "&" | "~" | Digit | [.?][a-z0-9?#~] //thus "." ok within a term but not at the end | "://" //thus a URL may be a term Number := ("+"|"-")? Digit+ ("." Digit* )? Digit := [0-9] //Additional notes on the lexical parsing: - uppercase letters are parsed as if they were lowercase letters - white spaces and the HTML imbreakable space encoding "&nbsp;" are ignored - Java/C++ comments ("/* ... */" and "//...") are ignored - HTML tags are ignored but the content of HTML comments is parsed - annotations are enclosed within "(^" and "^)" - strings may be single quoted, double quoted or enclosed within "$(" and ")$"