Parallaxis-III Syntax is specified in EBNF (Extended Backus-Naur-Form).
- CompilationUnit = ProgramModule
| DefinitionModule
|
ImplementationModule
| ForeignModule .
- ProgramModule = MODULE Ident ';' { Import } Block Ident '.' .
- DefinitionModule = DEFINITION MODULE Ident ';'
{ Import }
[ Export ] { Definition } END Ident '.' .
- ImplementationModule = IMPLEMENTATION MODULE Ident ';'
{
Import } Block Ident '.' .
- ForeignModule = FOREIGN MODULE Ident ';'
{ Import } [
Export ] { Definition } END Ident '.' .
- Definition = CONFIGURATION {ConfigDeclaration ';'}'
|
CONNECTION { ConnectionDeclaration ';'}
| CONST
{ConstantDeclaration ';'}
| TYPE {Ident [ '=' GeneralType ]
';'}
| VAR {VariableDeclaration ';'}
| ProcedureHeading ';' .
- Import = [ FROM Ident ] IMPORT IdentList ';' .
- Export = EXPORT [ QUALIFIED ] IdentList ';' .
- Block = {Declaration } [ BEGIN StatementSequence ] END .
- Declaration = CONFIGURATION {ConfigDeclaration ';'}
|
CONNECTION {ConnectionDeclaration ';'}
| CONST
{ConstantDeclaration ';'}
| TYPE {TypeDeclaration ';'}
|
VAR {VariableDeclaration ';'}
| ProcedureDeclaration ';' .
- ConfigDeclarartion = Config {';' Config } .
- Config = [ Ident [ '=' Qualident ] ConfigRange { ',' ConfigRange } ] .
- ConfigRange = '[' ConstExpression '..' ConstExpression ']`
| '[' '*'
']' .
- ConnectionDeclaration = TransferFunction
| FOR Ident ':='
Expression TO Expression DO
TransferFunction {';'
TransferFunction } END .
- TransferFunction = [ Direction ':' Qualident '[' Source {',' Source
}']'
( '->' Dest1 {',' Dest1} | '<->' Dest2 {',' Dest2} ) ]
- Direction = Ident [ '[' Source ']' ] .
- Source = Ident
| Integer
| String .
- Dest1 = [ Discriminant ] Qualident '[' DestExprList ']' .
- Dest2 = [ Discriminant ] Qualident '[' DestExprList ']' :' Ident
[ '['
Expression ']' ] .
- DestExprList = DestExpr {',' DestExpr } .
- DestExpr = Expression
| Expression '..' Expression
| '*' .
- Discriminant = '{' Expression '}' .
- ConstantDeclaration = Ident '=' ConstExpression .
- ConstExpression = Expression .
- TypeDeclaration = Ident '=' GeneralType .
- GenaralType = SimpleType
| GeneralArrayType
| GeneralRecordType
|
SetType
| PointerType
| ProcedureType
| ( VECTOR | Qualident )
OF ScalarType .
- ScalarType = SimpleType
| ScalarArrayType
| ScalarRecordType
|
SetType
| PointerType
| ProcedureType .
- GeneralArrayType = ARRAY SimpleType { ',' SimpleType } OF
GeneralType .
- GeneralRecordType = RECORD FieldListSequence1 END .
- FieldListSequence1 = [ FieldList1 { ';' FieldList1 } ] .
- FieldList1 = IdentList ':' GeneralType
| CASE [ Ident ] ':'
Qualident OF Variant { '|' Variant}
[ ELSE
FieldListSequence2 ] END .
- Variant = [ CaseLabelList ':' FieldListSequence2 ] .
- CaseLabelList = CaseLabels { `,' CaseLabels } .
- CaseLabels = ConstExpression [ '..' ConstExpression ] .
- ScalarArrayType = ARRAY SimpleType { ',' SimpleType } OF
ScalarType .
- ScalarRecordType = RECORD FieldListSequence2 END .
- FieldListSequence2 = [ FieldList2 {';' FieldList2 } ] .
- FieldList2 = IdentList ':' ScalarType
| CASE [ Ident ] ':'
Qualident OF Variant { '|' Variant }
[ ELSE
FieldListSequence2 ] END .
- SimpleType = Qualident
| Enumeration
| SubrangeType .
- Enumeration = '(' IdentList ')' .
- SubrangeType = [ Qualident ] '[` ConstExpression '..' ConstExpression ']'
.
- SetType = SET OF SimpleType .
- PointerType = POINTER TO GeneralType .
- ProcedureType = PROCEDURE [ FormalTypeList ] .
- FormalTypeList = '(' [ [ VAR ] FormalType { ';' [ VAR ]
FormalType } ] ')'
[ ':' [ ( VECTOR | Qualident ) OF ]
Qualident .
- FormalType = [ ( VECTOR | Qualident ) OF ] [
ARRAY OF ] Qualident .
- VariableDeclaration = IdentList ':' GeneralType .
- ProcedureDeclaration = ProcedureHeading ';' Block Ident .
- ProcedureHeading = PROCEDURE Ident [ FormalParameters ] .
- FormalParameters = '(' [ Parameter { ';' Parameter } ] ')' [ ':'
Qualident ] .
- Parameter = [ VAR ] IdentList ':' FormalType .
- StatementSequence = Statement {';' Statement } .
- Statement = [ Assignment
| ProcedureCall
| IfStatement
|
CaseStatement
| WhileStatement
| RepeatStatemen
| LoopStatement
|
ForStatement
| WithStatement
| EXIT
| RETURN [
Expression ]
| AllStatement
| SendStatement
| LoadStatement
|
StoreStatement ] .
- Assignment = Designator ':=' Expression .
- ExprList = Expression { ',' Expression } .
- Expression = SimpleExpression { RelationOperator SimpleExpression }.
- RelationOperator = '=' | '#' | '<>' | '<' | '<=' | '>'
| '>=' | IN .
- SimpleExpression = [ '+' | '-' ] Term { AddOperator Term } .
- AddOperator = '+' | '-' | OR .
- Term = Power { MulOperator Power } .
- MulOperator = '*' | '/' | DIV | MOD | AND |
'&' .
- Power = Factor { '**' Factor } .
- Factor = Number
| String
| Set
| Designator [ ActualParameters
]
| MoveFunction
| ReceiveFunction
| ReduceFunction
|
ArrayInitializer
| RecordInitializer
| '(' Expression ')'
| NOT
Factor
| '~' Factor .
- Set = [ Qualident ] '{' [ Element { ',' Element } ] '}' .
- Element = ConstExpression [ '..' ConstExpression ] .
- ActualParameters = '(' [ ExprList ] ')' .
- MoveFunction = MOVE '.' DirectionSpecifier '(' Expression ')' .
- DirectionSpecifier = Ident [ '[' Expression ']' ] [ ':' StepSpecifier ] [
':#' ReductIdent ]
| '<<' Expression '>>' [ ':#'
ReductIdent]
| '<:' Dimension { ',' Dimension } ':>' [ ':#'
ReductIdent] .
- StepSpecifier = '(' Expression ')' | Qualident | Integer .
- ReductIdent = AND | OR | Qualident .
- ReceiveFunction = RECEIVE '.' DirectionSpecifier '(' Expression ')'
.
- ReduceFunction = REDUCE '.' ReductIdent '(' Expression ')' .
- ArrayInitializer = Qualident '(' ExprList ')' .
- RecordInitializer = Qualident '(' ExprList ')' .
- ProcedureCall = Designator [ ActualParameters ] .
- IfStatement = IF Expression THEN StatementSequence
{
ELSIF Expression THEN StatementSequence}
[ ELSE
StatementSequence ] END .
- CaseStatement = CASE Expression OF Case { '|' Case }
[
ELSE StatementSequence ] END .
- Case = [ CaseLabelList ':' StatementSequence ] .
- WhileStatement = WHILE Expression DO StatementSequence
END .
- RepeatStatement = REPEAT StatementSequence UNTIL Expression
.
- ForStatement = FOR Ident ':=' Expression TO
Expression
[ BY ConstExpression ] DO StatementSequence
END .
- LoopStatement = LOOP [ OF Qualident DO ]
StatementSequence END .
- WithStatement = WITH Designator DO StatementSequence
END .
- AllStatement = ALL Qualident DO StatementSequence
END .
- SendStatement = SEND '.' DirectionSpecifier '(' Expression ','
Designator ')' .
- LoadStatement = LOAD '(' Designator ',' Designator [ ','
Designator ] ')' .
- StoreStatement = STORE '(' Designator ',' Designator [ ','
Designator ] ')' .
- Designator = Qualident { << Expression >> | <: ExprList
:>
| '.' Ident | '[' ExprList ']' | '^' } .
- Dimension = Expression | '*' | '#' ReductIdent .
- Qualident = Ident [ '.' Ident ] .
- IdentList = Ident { ',' Ident } .
- Ident = Letter { Letter | Digit } .
- Letter = ( 'A' .. 'Z' | 'a' .. 'z' | '_' ) .
- String = ' ' ' { Character } ' ' ' | ' " ' { Character } ' " ' .
- Number = Integer | Real .
- Integer = Digit { Digit } [ 'D' ]
| OctalDigit { OctalDigit } ( 'B'
| 'C' )
| Digit { HexDigit } 'H' .
- Real = Digit { Digit } '.` { Digit } [ ScaleFactor ] .
- ScaleFactor = 'E' [ '+' | '-' ] Digit { Digit } .
- HexDigit = Digit | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' .
- Digit = OctalDigit | '8' | '9' .
- OctalDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7'
[
Previous Page |
Table of Contents ]