Extended BNF grammar for FCG
"?" means 0 or 1 times, "*" means 0 to N times, "+" means 1 to N times)
FCG := "~"? "[" Concept Relations? "]" Context?
Context := "(" Relation Relations? ")"
Relations := ("," Relation)+
Relation := Path_specif? RelationCore Concept
Path_specif := Path_term ("|" Path_term)*
Path_term := Path_factor Path_factor*
Path_factor := "(" RelationCore Concept? ")" Count
| "(" Path_specif ")" Count
Count := "?" | "*" | Number? "+" | Number
RelationCore := (RelationType|Coreference)
"of"? Annotation? Context? (":" | "<=")
| ("=>" | "<=>" | "<=" )
| ("=" | "!=" | "<" | "=<" | ">" | ">=" )
| "?" ":"
RelationType := Term_or_string
Coreference := "*" Term
Concept := ConceptCore Annotation?
| "(" ConceptCore Annotation? Relations? ")"
ConceptCore := Quantifier SameDiff? Restrictor CorefDeclar? CFIQ?
| GroupOf Quantifier? Restrictor CorefDeclar? (Collection|"?")?
| GroupOf Quantifier? CorefDeclar? Collection
| CorefDeclar? CFIQ
| Coreference
CorefDeclar := "*" Term | "*" Term "!=" "*" Term
SameDiff := "same" | "different"
CFIQ := Collection | FCG | IndivOrAttr FCG? | "?"
Restrictor := Qualifier? ConceptType
| Qualifier? "(" ConceptType CorefDeclar? Relations? ")"
ConceptType := Term_or_string
IndivOrAttr := Term_or_string ("\\" ConceptType)?
//Individual (e.g. Paris) or attribute type (e.g. high)
Qualifier := "good" | "bad"
| "important" | "small" | "big" | "great" | "few"
Quantifier := "a" | "an" | "some" | "the" | "any" | "every" | "mostly"
| "several" "of"? "the"?
| "many" "of"? "the"? | "most" "of"? "the"?
| Number "%"? "of"? "the"?
| Number "%"? "to" Number "%"? "of"? "the"?
| "at" "least" Number "%"? "of"? "the"?
| "at" "most" Number "%"? "of"? "the"?
| "between" Number "%"? "and" Number "%"? "of"? "the"?
| ("dozens"|"hundreds"
|"thousands"|"millions"|"billions") "of"? "the"?
GroupOf := ("a"|"the") ("group" "of" | "bag" "of" | "set" "of"
| "sequence" "of"| "alternative")
| "together"
Collection := "{" (Bag|Set|Sequence|Alternatives) "}" CollSize?
Bag := Element (',' Element)*
Set := Element ('&' Element)*
Sequence := Element ('<' Element)*
Alternatives := Element ('|' Element)*
Element := Concept | "*"
CollSize := "@" Number
Number := ("+"|"-")? Digit+ ("." Digit* )?
Digit := [0-9]
Term_or_string:= Term | string
Term := TermLetter1 TermLetter*
TermLetter1 := [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
//Additional notes on the lexical parsing:
- uppercase letters are parsed as if they were lowercase letters
- white spaces and the HTML imbreakable space encoding " " are ignored
- Java/C++ comments ("/* ... */" and "//...") are ignored
- HTML tags and HTML comments ("") are ignored
- annotations have two forms: "(* ... *)" and "$( ... )$"
- strings may be simple quoted or double quoted