A.4. Parallaxis-III Syntax

Parallaxis-III Syntax is specified in EBNF (Extended Backus-Naur-Form).

  1. CompilationUnit = ProgramModule
    | DefinitionModule
    | ImplementationModule
    | ForeignModule .
  2. ProgramModule = MODULE Ident ';' { Import } Block Ident '.' .
  3. DefinitionModule = DEFINITION MODULE Ident ';'
    { Import } [ Export ] { Definition } END Ident '.' .
  4. ImplementationModule = IMPLEMENTATION MODULE Ident ';'
    { Import } Block Ident '.' .
  5. ForeignModule = FOREIGN MODULE Ident ';'
    { Import } [ Export ] { Definition } END Ident '.' .

  6. Definition = CONFIGURATION {ConfigDeclaration ';'}'
    | CONNECTION { ConnectionDeclaration ';'}
    | CONST {ConstantDeclaration ';'}
    | TYPE {Ident [ '=' GeneralType ] ';'}
    | VAR {VariableDeclaration ';'}
    | ProcedureHeading ';' .

  7. Import = [ FROM Ident ] IMPORT IdentList ';' .

  8. Export = EXPORT [ QUALIFIED ] IdentList ';' .

  9. Block = {Declaration } [ BEGIN StatementSequence ] END .

  10. Declaration = CONFIGURATION {ConfigDeclaration ';'}
    | CONNECTION {ConnectionDeclaration ';'}
    | CONST {ConstantDeclaration ';'}
    | TYPE {TypeDeclaration ';'}
    | VAR {VariableDeclaration ';'}
    | ProcedureDeclaration ';' .

  11. ConfigDeclarartion = Config {';' Config } .

  12. Config = [ Ident [ '=' Qualident ] ConfigRange { ',' ConfigRange } ] .

  13. ConfigRange = '[' ConstExpression '..' ConstExpression ']`
    | '[' '*' ']' .

  14. ConnectionDeclaration = TransferFunction
    | FOR Ident ':=' Expression TO Expression DO
    TransferFunction {';' TransferFunction } END .

  15. TransferFunction = [ Direction ':' Qualident '[' Source {',' Source }']'
    ( '->' Dest1 {',' Dest1} | '<->' Dest2 {',' Dest2} ) ]

  16. Direction = Ident [ '[' Source ']' ] .

  17. Source = Ident
    | Integer
    | String .

  18. Dest1 = [ Discriminant ] Qualident '[' DestExprList ']' .

  19. Dest2 = [ Discriminant ] Qualident '[' DestExprList ']' :' Ident
    [ '[' Expression ']' ] .

  20. DestExprList = DestExpr {',' DestExpr } .

  21. DestExpr = Expression
    | Expression '..' Expression
    | '*' .

  22. Discriminant = '{' Expression '}' .

  23. ConstantDeclaration = Ident '=' ConstExpression .

  24. ConstExpression = Expression .

  25. TypeDeclaration = Ident '=' GeneralType .

  26. GenaralType = SimpleType
    | GeneralArrayType
    | GeneralRecordType
    | SetType
    | PointerType
    | ProcedureType
    | ( VECTOR | Qualident ) OF ScalarType .

  27. ScalarType = SimpleType
    | ScalarArrayType
    | ScalarRecordType
    | SetType
    | PointerType
    | ProcedureType .

  28. GeneralArrayType = ARRAY SimpleType { ',' SimpleType } OF GeneralType .

  29. GeneralRecordType = RECORD FieldListSequence1 END .

  30. FieldListSequence1 = [ FieldList1 { ';' FieldList1 } ] .

  31. FieldList1 = IdentList ':' GeneralType
    | CASE [ Ident ] ':' Qualident OF Variant { '|' Variant}
    [ ELSE FieldListSequence2 ] END .

  32. Variant = [ CaseLabelList ':' FieldListSequence2 ] .

  33. CaseLabelList = CaseLabels { `,' CaseLabels } .

  34. CaseLabels = ConstExpression [ '..' ConstExpression ] .

  35. ScalarArrayType = ARRAY SimpleType { ',' SimpleType } OF ScalarType .

  36. ScalarRecordType = RECORD FieldListSequence2 END .

  37. FieldListSequence2 = [ FieldList2 {';' FieldList2 } ] .

  38. FieldList2 = IdentList ':' ScalarType
    | CASE [ Ident ] ':' Qualident OF Variant { '|' Variant }
    [ ELSE FieldListSequence2 ] END .

  39. SimpleType = Qualident
    | Enumeration
    | SubrangeType .

  40. Enumeration = '(' IdentList ')' .

  41. SubrangeType = [ Qualident ] '[` ConstExpression '..' ConstExpression ']' .

  42. SetType = SET OF SimpleType .

  43. PointerType = POINTER TO GeneralType .

  44. ProcedureType = PROCEDURE [ FormalTypeList ] .

  45. FormalTypeList = '(' [ [ VAR ] FormalType { ';' [ VAR ] FormalType } ] ')'
    [ ':' [ ( VECTOR | Qualident ) OF ] Qualident .

  46. FormalType = [ ( VECTOR | Qualident ) OF ] [ ARRAY OF ] Qualident .

  47. VariableDeclaration = IdentList ':' GeneralType .

  48. ProcedureDeclaration = ProcedureHeading ';' Block Ident .

  49. ProcedureHeading = PROCEDURE Ident [ FormalParameters ] .

  50. FormalParameters = '(' [ Parameter { ';' Parameter } ] ')' [ ':' Qualident ] .

  51. Parameter = [ VAR ] IdentList ':' FormalType .

  52. StatementSequence = Statement {';' Statement } .

  53. Statement = [ Assignment
    | ProcedureCall
    | IfStatement
    | CaseStatement
    | WhileStatement
    | RepeatStatemen
    | LoopStatement
    | ForStatement
    | WithStatement
    | EXIT
    | RETURN [ Expression ]
    | AllStatement
    | SendStatement
    | LoadStatement
    | StoreStatement ] .

  54. Assignment = Designator ':=' Expression .

  55. ExprList = Expression { ',' Expression } .

  56. Expression = SimpleExpression { RelationOperator SimpleExpression }.

  57. RelationOperator = '=' | '#' | '<>' | '<' | '<=' | '>' | '>=' | IN .

  58. SimpleExpression = [ '+' | '-' ] Term { AddOperator Term } .

  59. AddOperator = '+' | '-' | OR .

  60. Term = Power { MulOperator Power } .

  61. MulOperator = '*' | '/' | DIV | MOD | AND | '&' .

  62. Power = Factor { '**' Factor } .

  63. Factor = Number
    | String
    | Set
    | Designator [ ActualParameters ]
    | MoveFunction
    | ReceiveFunction
    | ReduceFunction
    | ArrayInitializer
    | RecordInitializer
    | '(' Expression ')'
    | NOT Factor
    | '~' Factor .

  64. Set = [ Qualident ] '{' [ Element { ',' Element } ] '}' .

  65. Element = ConstExpression [ '..' ConstExpression ] .

  66. ActualParameters = '(' [ ExprList ] ')' .

  67. MoveFunction = MOVE '.' DirectionSpecifier '(' Expression ')' .

  68. DirectionSpecifier = Ident [ '[' Expression ']' ] [ ':' StepSpecifier ] [ ':#' ReductIdent ]
    | '<<' Expression '>>' [ ':#' ReductIdent]
    | '<:' Dimension { ',' Dimension } ':>' [ ':#' ReductIdent] .

  69. StepSpecifier = '(' Expression ')' | Qualident | Integer .

  70. ReductIdent = AND | OR | Qualident .

  71. ReceiveFunction = RECEIVE '.' DirectionSpecifier '(' Expression ')' .

  72. ReduceFunction = REDUCE '.' ReductIdent '(' Expression ')' .

  73. ArrayInitializer = Qualident '(' ExprList ')' .

  74. RecordInitializer = Qualident '(' ExprList ')' .

  75. ProcedureCall = Designator [ ActualParameters ] .

  76. IfStatement = IF Expression THEN StatementSequence
    { ELSIF Expression THEN StatementSequence}
    [ ELSE StatementSequence ] END .

  77. CaseStatement = CASE Expression OF Case { '|' Case }
    [ ELSE StatementSequence ] END .

  78. Case = [ CaseLabelList ':' StatementSequence ] .

  79. WhileStatement = WHILE Expression DO StatementSequence END .

  80. RepeatStatement = REPEAT StatementSequence UNTIL Expression .

  81. ForStatement = FOR Ident ':=' Expression TO Expression
    [ BY ConstExpression ] DO StatementSequence END .

  82. LoopStatement = LOOP [ OF Qualident DO ] StatementSequence END .

  83. WithStatement = WITH Designator DO StatementSequence END .

  84. AllStatement = ALL Qualident DO StatementSequence END .

  85. SendStatement = SEND '.' DirectionSpecifier '(' Expression ',' Designator ')' .

  86. LoadStatement = LOAD '(' Designator ',' Designator [ ',' Designator ] ')' .

  87. StoreStatement = STORE '(' Designator ',' Designator [ ',' Designator ] ')' .

  88. Designator = Qualident { << Expression >> | <: ExprList :>
    | '.' Ident | '[' ExprList ']' | '^' } .

  89. Dimension = Expression | '*' | '#' ReductIdent .

  90. Qualident = Ident [ '.' Ident ] .

  91. IdentList = Ident { ',' Ident } .

  92. Ident = Letter { Letter | Digit } .

  93. Letter = ( 'A' .. 'Z' | 'a' .. 'z' | '_' ) .

  94. String = ' ' ' { Character } ' ' ' | ' " ' { Character } ' " ' .

  95. Number = Integer | Real .

  96. Integer = Digit { Digit } [ 'D' ]
    | OctalDigit { OctalDigit } ( 'B' | 'C' )
    | Digit { HexDigit } 'H' .

  97. Real = Digit { Digit } '.` { Digit } [ ScaleFactor ] .

  98. ScaleFactor = 'E' [ '+' | '-' ] Digit { Digit } .

  99. HexDigit = Digit | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' .

  100. Digit = OctalDigit | '8' | '9' .

  101. OctalDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7'


    [ Previous Page | Table of Contents ]