[ Inhalt ] [ Index ]

Next: Ein Beispiel Up: Die Sprache OBERON-0 Previous: Die Symbole von OBERON-0

Die Syntax von OBERON-0

Deklarationen

IdentList        = ident {``,'' ident}.
ArrayType        = ``ARRAY'' Expression ``OF'' type.
FieldlList       = [IdentList ``:'' Type]
RecordType       = ``RECORD'' FieldList 
                              {``;'' FieldList} ``END''.
Type             = ident | ArrayType | RecordType.
FPSection        = [``VAR''] IdentList ``:'' Type.
FormalParameters = ``(`` [FPSection {``;'' FPSection}] ``)''.
ProcedureHeading = ``PROCEDURE'' ident [FormalParameters].
ProcedureBody    = Declarations 
                   [``BEGIN'' StatementSequence] ``END.
ProcedureDeclaration 
                 = ProcedureHeading ``;'' 
                   ProcedureBody ident.
Declarations     = [``CONST'' {ident ``='' Expression ``;''}]
                   [``TYPE'' {ident ``='' Type ``;'' }]
                   [``VAR'' {IdentList ``:'' Type ``;''}]
                   {ProcedureDeclaration ``;''}.
Module           = ``MODULE'' ident ``;'' Declarations
                   [``BEGIN'' StatementSequence] 
                   ``END'' ident ``.''.

Anweisungen

Assignment        = ident Selector ``:='' Expression.
ActualParameters  = ``(``[Expression 
                          {``,'' Expression}] '')''.
ProcedureCall     = ident [ActualParameters].
IfStatement       = ``IF'' Expression 
                    ``THEN'' StatementSequence
                    {``ELSEIF'' Expression 
                     StatementSequence}       
                    [``ELSE'' StatementSequence] ``END''.   
WhileStatement    = ``WHILE'' Expression ``DO'' 
                    StatementSequence ``END''.
RepeatStatement   = ``REPEAT'' StatementSequence 
                    ``UNTIL'' Expression.
Statement         = [Assignment | ProcedureCall |
                     IfStatement |
                     WhileStatement | RepeatStatement].
StatementSequence = Statement {``;'' Statement}.

Ausdrücke

ident            = letter {letter | digit}.
integer          = digit {digit}.
Selector         = {``.'' ident | ``['' Expression ``]''}.
Factor           = ident Selector | integer | 
                   ``(`` Expression ``)'' | ``~`` Factor.
Term             = Factor {(``*'' | ``DIV'' | 
                            ``MOD'' | ``&'') Factor}.
SimpleExpression = [``+'' | ``-''] Term  
                   {(``+'' | ``-'' | ``OR'') Term}.
Expression       = SimpleExpression
                   [(``='' | ``#'' | ``<'' | 
                     ``<='' | ``>'' | ``>='') 
                    SimpleExpression].




Next: Ein Beispiel Up: Die Sprache OBERON-0 Previous: Die Symbole von OBERON-0

Prof. Dr. Reinhard Völler