Объектный Паскаль (Delphi 1.0)
Описание подготовлено Т. Перешиваловой
Letter = "A"|"B"|"C"|"D"|"E"|"F"|"G"|"Q"|"W"|"R"|"T"|"Y"|"U"|"I"|"O"|"P"|"S"|
"H"|"J"|"K"|"L"|"Z"|"X"|"V"|"N"|"M"|"q"|"w"|"e"|"r"|"t"|"y"|"u"|"i"|"o"|"p"|
"a"|"s"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"z"|"x"|"c"|"v"|"b"|"n"|"m" .
HexDigit = Digit | [ "A"|"B"|"C"|"D"|"E"|"F"|"a"|"b"|"c"|"d"|"e"|"f"].
ArrayType = ARRAY "[" IndexType { "." IndexType } "]" OF Type.
IndexType = OrdinalType.
Label = DigitSequence | Identifier.
ConstantDeclarationPart = CONST ConstantDeclaration | TypeDeclaration
{ ConstantDeclaration | TypeDeclaration }.
ConstantDeclaration = Identifier "=" Constant ";"{Identifier "=" Constant ";"}.
Constant = Expression .
TypeDeclaration= Identifier "=" Type ";".
Type = SimpleType| StringType| StructuredType| PointerType|
ProceduralType| ClassReferenceType.
SimpleType = OrdinalType| RealType.
RealType = RealTypeIdentifier.
RealTypeIdentifier = Identifier.
OrdinalType = SubrangeType| EnumeratedType| OrdinalTypeIdentifier.
OrdinalTypeIdentifier = Identifier.
SubrangeType = Constant ".." Constant .
EnumeratedType = "(" IdentifierList ")".
IdentifierList = Identifier { "." Identifier }.
StringType = STRING [ "[" UnsignedNumber "]" ] .
StructuredType = [ PACKED ] ArrayType| RecordType| ObjectType| SetType|
FileType .
RecordType = RECORD [ FieldList ] END.
FieldList = FixedPart [ ":" VariantPart ] [ ":" ] | VariantPart [ ":" ] .
FixedPart = IdentifierList ":" Type { ":" IdentifierList ":" Type }.
VariantPart = CASE [ Identifier ":" ] TagFieldType OF ( Variant| ";" ).
TagFieldType = OrdinalTypeIdentifier.
Variant = Constant { "," Constant } ":" "(" [ FieldList ] ")" .
ObjectType = CLASS [ Heritage ] [ ComponentList { VisibilitiSpecifier } ].
VisibilitiSpecifier = PUBLISHED| PUBLIC| PROTECTED| PRIVATE .
Heritage = "(" ObjectTypeIdentifier ")" .
ComponentList =[{ FieldDefinition}] [ MethodDefinition| PropertyDefinition
{ MethodDefinition| PropertyDefinition } ].
PropertyDefinition = Identifier[PropertyInterface] PropertySpecifier ";".
PropertyInterface = [PropertyParameterList] ":" TypeIdentifier [ INDEX
IntegerConstant ].
PropertyParameterList = "[" ParameterDeclaration {";" ParameterDeclaration}"]".
PropertySpecifier = [ ReadSpecifier ] [ WriteSpecifier] [ StoredSpecifier]
[ DefaultSpecifier].
DefaultSpecifier = ( DEFAULT Constant ) | NODEFAULT.
StoredSpecifier = STORED ( FieldOrMethod | BooleanConstant ).
BooleanConstant = TRUE | FALSE.
WriteSpecifier = WRITE FieldOrMethod.
ReadSpecifier = READ FieldOrMethod.
FieldOrMethod = FieldIdentifier | MethodIdentifier.
FieldDefinition = IdentifierList ":" Type ";" .
MethodDefinition = MethodHeading ";" MethodDirectives.
MethodHeading = ( [ CLASS ] ( ProcedureHeading| FunctionHeading ) )|
( ConstructorHeading| DestructorHeading ) .
MethodDirectives = [ VIRTUAL | DYNAMIC| ( MESSAGE IntegerConstant ) ":" ]
[ CDECL ";" ] [ EXPORT ";" ] [ ABSTRACT ";" ] .
IntegerConstant = DigitSequence.
SetType = SET OF OrdinalType .
FileType = FILE [ OF Type ] .
PointerType = " ^ " BaseType .
BaseType = TypeIdentifier .
TypeIdentifier = Identifier.
ProceduralType = ( PROCEDURE [ FormalParameterList ] ) | ( FUNCTION
[ FormalParameterList ] ":" Result ).
FormalParameterList = "(" ParameterDeclaration { ";" ParameterDeclaration}")".
ParameterDeclaration = [ VAR| CONST] IdentifierList [":" ParameterType].
ParameterType = Type.
Result = QualifiedIdentifier.
ClassReferenceType = CLASS OF ObjectTypeIdentifier .
ObjectTypeIdentifier = Identifier.
Variable = IdentifierList ":" Type [ AbsoluteClause ] ";" .
AbsoluteClause = ABSOLUTE ( UnsignedInteger ":" UnsignedInteger)|
Identifier.
ProcedureStatement = ( ProcedureIdentifier| MethodDesignator|
QualifiedMethodDesignator| VariableReference ) [ ActualParameterList ] .
ProcedureIdentifier = Identifier.
MethodDesignator = [ VariableReference "."] MethodIdentifier.
MethodIdentifier = QualifiedIdentifier.
VariableReference = ( VariableIdentifier| VariableTypeCast| ExpressionQualifier)
{ Qualifier }.
FieldIdentifier = QualifiedIdentifier.
Qualifier = Index | FieldDesignator | " ^ " .
FieldDesignator = "." TypeIdentifier.
Index = "[" Expression { "," Expression } "]".
VariableTypeCast = TypeIdentifier | STRING | FILE.
ExpressionQualifier = Expression.
VariableIdentifier = QualifiedIdentifier.
FunctionCall = ( FunctionIdentifier| MethodDesignator|
QualifiedMethodDesignator| VariableReference ) [ ActualParameterList ].
FunctionIdentifier = Identifier.
ActualParameterList = "(" ActualParameter { "," ActualParameter } ")".
ActualParameter = Expression| VariableReference .
ExportsClause = EXPORTS ExportsList ";" .
ExportsList = ExportsEntry { "," ExportsEntry } .
ExportsEntry = Identifier [ INDEX IntegerConstant ] [ NAME StringConstant ]
[ RESIDENT ] .
StatementPart = CompoundStatement .
StringConstant = Constant.
CompoundStatement = BEGIN Statement { ";" Statement } END .
CharString = QuotedString| ControlString { QuotedString| ControlString }.
QuotedString = "'" { StringCharacter } "'" .
StringCharacter = любойсимволкромекавычекилиch| "'" "'" .
ControlString = "#" UnsignedInteger { "#" UnsignedInteger } .
Expression = SimpleExpression [ "<"| "<="| ">"| ">="| "="| "<>"| IN
SimpleExpression ].
SimpleExpression = Term { "+"| "-"| OR | XOR Term } .
Term = Factor { "'"| "/"| "'"| DIV | MOD | AND | SHL | SHR Factor } .
Factor = VariableReference| UnsignedConstant| ( "(" Expression ")" )|
( NOT Factor )| ( Sign Factor )| FunctionCall| SetConstructor| ValueTypeCast|
AddressFactor| ( VariableReference IS TypeIdentifier )| ( VariableReference
AS TypeIdentifier ) .
AddressFactor = "@" ( VariableReference| ProcedureIdentifier|
FunctionIdentifier| QualifiedIdentifier ).
ValueTypeCast = TypeIdentifier "(" Expression ")" .
UnsignedConstant = UnsignedNumber| CharString| ConstantIdentifier| NIL .
ConstantIdentifier = Identifier.
FunctionDeclaration = FunctionHeading ";" SubroutineBlock ";" .
FunctionHeading = FUNCTION ( Identifier| QualifiedIdentifier )
[ FormalParameterList ] ":" Result ( TypeIdentifier| STRING ).
Identifier = (Letter| Underscore ) { Letter| Digit| Underscore }.
Underscore = "_ ".
QualifiedIdentifier = Identifier {"." Identifier } .
RepetitiveStatement = RepeatStatement| WhileStatement| ForStatement .
MethodDefinition = MethodHeading ";" MethodDirectives .
QualifiedMethodDesignator = (ObjectTypeIdentifier ".")| INHERITED
QualifiedIdentifier.
DigitSequence = Digit { Digit }.
UnsignedInteger = DigitSequence | ( "$" HexDigitSequence ) .
Sign = "+"|"-".
UnsignedReal = DigitSequence ( "." DigitSequence| "." DigitSequence
ScaleFactor| ScaleFactor ).
UnsignedNumber = UnsignedInteger| UnsignedReal .
SignedNumber = [ Sign ] UnsignedNumber .
HexDigitSequence = HexDigit { HexDigit } .
ScaleFactor = ("E"|"e" ) [ Sign ] DigitSequence .
ProcedureHeading = PROCEDURE ( Identifier| QualifiedMethodIdentifier )
[ FormalParameterList ] .
QualifiedMethodIdentifier = QualifiedIdentifier.
Block = DeclarationPart StatementPart.
DeclarationPart = [ LabelDeclarationPart| ConstantDeclarationPart|
TypeDeclarationPart| VariableDeclarationPart| ProcedureDeclaration|
FunctionDeclaration| ExportsClause ] { LabelDeclarationPart|
ConstantDeclarationPart|TypeDeclarationPart| VariableDeclarationPart|
ProcedureDeclaration|FunctionDeclaration| ExportsClause }.
SubroutineBlock = [InlineDirective]|[ NEAR| FAR| EXPORT| INTERRUPT ] [ ";" ]
( Block|externaldirective | AsmBlock|FORWARD ).
AsmBlock = ASSEMBLER ";" DeclarationPart asmstatement.
ProcedureDeclaration = ProcedureHeading ";" SubroutineBlock ";".
CaseStatement = CASE Expression OF Case { ";" Case } [ElsePart ] [ ";" ] END.
Case = Constant [ ".." Constant ] { "," Constant [ ".." Constant ] } ":"
Statement .
ElsePart = ELSE Statement .
ConstructorHeading = CONSTRUCTOR ( Identifier | QualifiedMethodIdentifier )
[ FormalParameterList ] .
DestructorDeclaration = DestructorHeading ";" SubroutineBlock ";" .
DestructorHeading = DESTRUCTOR ( Identifier| QualifiedMethodIdentifier )
[ FormalParameterList ] .
ForStatement = FOR ControlVariable ":=" InitialValue ( TO| DOWNTO )
FinalValue DO Statement .
ControlVariable = VariableIdentifier .
InitialValue = Expression .
FinalValue = Expression .
Except = TRY StatementList ( FINALLY StatementList )|( EXCEPT ExceptionBlock)
END.
ExceptionBlock = ( ExceptionHandler { ";" ExceptionHandler } [ ELSE
StatementList ] )| StatementList .
ExceptionHandler = ON [ Identifier ":" ] ClassTypeIdentifier DO Statement .
ClassTypeIdentifier= TypeIdentifier.
ExportsClause = EXPORTS ExportsList ";" .
ExportsList = ExportsEntry { "," ExportsEntry } .
FileType = FILE [ OF Type ] .
StatementList = Statement { ";" Statement }.
Goto = GOTO Label .
IfStatement = IF Expression THEN Statement [ ELSE Statement ] .
ImplementationPart = IMPLEMENTATION [ UsesClause ] DeclarationPart .
InitializationPart = ( INITIALIZATION | BEGIN ) Statement { ";" Statement }.
InterfacePart = INTERFACE [ UsesClause ] ( ConstantDeclarationPart |
TypeDeclarationPart|VariableDeclarationPart| ProcedureAndFunctionHeadingPart)
{ ConstantDeclarationPart|TypeDeclarationPart|VariableDeclarationPart|
ProcedureAndFunctionHeadingPart}.
ProcedureAndFunctionHeadingPart = ( ProcedureHeading | FunctionHeading )
";" [ InlineDirective ";" ].
InlineDirective = InlineStatement.
InlineStatement = INLINE "(" InlineElement { "/" InlineElement } ")".
InlineElement = ([ "<"| ">" ] Constant )| (VariableIdentifier[SignConstant
{ SignConstant }]).
SignConstant = Sign.
LabelDeclarationPart = LABEL Label { "," Label } ";" .
Library = LibraryHeading ";" [ UsesClause ] Block "." .
LibraryHeading = LIBRARY Identifier .
ProgramHeading = PROGRAM Identifier [ "(" ProgramParameters ")" ] .
ProgramParameters = IdentifierList.
RepeatStatement = REPEAT Statement { ";" Statement } UNTIL Expression .
SetConstructor = "[" [ MemberGroup { "," MemberGroup } ] "]" .
MemberGroup = Expression [ ".." Expression ] .
TypeDeclarationPart = TYPE TypeDeclaration { TypeDeclaration } .
TypeDeclaration = Identifier "=" Type ";" .
UsesClause = USES Identifier { "," Identifier } ";" .
VariableDeclarationPart = VAR VariableDeclaration { VariableDeclaration } .
VariableDeclaration = IdentifierList ":" Type [ AbsoluteClause ] ";" .
WhileStatement = WHILE Expression DO Statement .
WithStatement = WITH RecordOrObjectVariableReference
{ ","RecordOrObjectVariableReference} DO Statement .
RecordOrObjectVariableReference = VariableReference .
Statement = [ Label ":" ] [ SimpleStatement| StructuredStatement ].
SimpleStatement = AssignmentStatement| ProcedureStatement| GotoStatement .
StructuredStatement = CompoundStatement| ConditionalStatement|
RepetitiveStatement| WithStatement .
AssignmentStatement = ( VariableReference| FunctionIdentifier ) ":="
Expression.
GotoStatement = GOTO Label.
CompoundStatement = BEGIN Statement { ";" Statement } END.
ConditionalStatement = IfStatement| CaseStatement .
TypedConstantDeclaration = Identifier ":" Type "=" TypedConstant.
TypedConstant = Constant| AddresConstant| ArrayConstant| RecordConstant|
ProceduralConstant.
AddresConstant = Constant ":" Constant.
ArrayConstant = "(" TypedConstant { "," TypedConstant } ")".
RecordConstant = "(" IdentifierField ":" TypedConstant { ";"
IdentifierField ":" TypedConstant } ")".
IdentifierField = Identifier.
ProceduralConstant = ProcedureIdentifier| FunctionIdentifier| NIL.
Unit = UnitHeading ";" InterfacePart ImplementationPart InitionalizationPart
".".
InitionalizationPart = END| OperatorPart.
OperatorPart = UsesClause.
UnitHeading = UNIT UnitIdentifier .
UnitIdentifier = Identifier.
Digit = "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9".