Мельница данных (12.10.2024) | |
Формальная грамматика | |
001Goal: MethodBody | Expression; 002 003MethodBody: [ConstantDeclaration] [VariableDeclaration] CompoundStatement ";"; 004 005ConstantDeclaration: "const" Ident ":" DomainSpecification ";" 006 [{Ident ":" DomainSpecification ";"}]; 007 008VariableDeclaration: "var" DomainDefinition [{DomainDefinition}]; 009 010DomainDefinition: Ident ":" DomainSpecification ";"; 011 012DomainSpecification: IntegerDomainDefinition 013 | StringDomainDefinition 014 | FloatDomainDefinition 015 | DateDomainDefinition 016 | TimeDomainDefinition 017 | DateTimeDomainDefinition 018 | BooleanDomainDefinition 019 | BlobDomainDefinition 020 | EnumerationDomainDefinition 021 | Ident; 022 023IntegerDomainDefinition: "integer"; 024StringDomainDefinition: "string" "[" Number "]"; 025FloatDomainDefinition: "float" ["(" Number ["." Number] ")"]; 026DateDomainDefinition: "date"; 027TimeDomainDefinition: "time"; 028DateTimeDomainDefinition: "datetime"; 029BooleanDomainDefinition: "boolean"; 030BlobDomainDefinition: "blob" | "clob"; 031EnumerationDomainDefinition: "(" Ident {"," Ident} ")"; 032 033CompoundStatement: "begin" Statement [{";" Statement}] "end"; 034 035Statement: 036 | CompoundStatement 037 | AssignmentStatement 038 | InheritedStatement 039 | CallStatement 040 | IfStatement 041 | CaseStatement 042 | ForStatement 043 | WhileStatement 044 | RepeatStatement 045 | TryFinallyStatement 046 | TryExceptStatement 047 | RaiseStatement 048 | ForEachStatement 049 | ExitStatement; 050 051AssignmentStatement: Qualifier ":=" Expression; 052 053CallStatement: Qualifier; 054 055InheritedStatement: "inherited"; 056 057IfStatement: "if" Expression "then" Statement ["else" Statement]; 058 059CaseStatement: "case" Expression "of" {CaseBranch} ["else" Statement ";"] "end"; 060 061CaseBranch: CaseLabel [{',' CaseLabel}] ":" Statement ";"; 062 063CaseLabel: Number | Ident; 064 065ForStatement: "for" Ident ":=" Expression ("to"|"downto") 066 Expression "do" Statement; 067 068WhileStatement: "while" Expression "do" Statement; 069 070RepeatStatement: "repeat" Statement [{";" Statement}] "until" Expression; 071 072TryFinallyStatement: "try" Statement [{";" Statement}] "finally" 073 Statement [{";" Statement}] "end"; 074 075TryExceptStatement: "try" Statement [{";" Statement}] "except" 076 Statement [{";" Statement}] "end"; 077 078RaiseStatement: "raise" [Expression]; 079 080ForEachStatement: "for" "each" Ident "of" Ident ["with" Expression] 081 ["by" Expression] "do" Statement; 082 083ExitStatement: "exit"; 084 085Expression: ComparedExpression [{RelationOperation Expression}]; 086 087ComparedExpression: Addon [{AdditionOperaton ComparedExpression}]; 088 089Addon: Factor [{MultiplicativeOperation Addon}]; 090 091Factor: "(" Expression ")" 092 | "not" Expression 093 | Number ["." Number] 094 | StringConstant 095 | Qualifier 096 | "nil" 097 | "True" 098 | "False" 099 | "(" Expression "is" Ident ")" 100 | "any" Aggregate 101 | "count" Aggregate 102 | "sum" Aggregate 103 | "max" Aggregate 104 | "min" Aggregate; 105 106Aggregate: "(" Ident ["." Ident] ["with" Expression] ")"; 107 108Qualifier: QualifierPart [{"." QualifierPart}]; 109 110QualifierPart: Ident ["(" Expression [{", " Expression}] ")"] 111 | "self" 112 | "(" Qualifier "as" Ident ")"; 113 114RelationOperation: "<" 115 | ">" 116 | "<=" 117 | ">=" 118 | "=" 119 | "<>"; 120 121AdditionOperaton: "+" 122 | "-" 123 | "or"; 124 125MultiplicativeOperation: "*" 126 | "/" 127 | "div" 128 | "and"; |