A BETA programozási nyelv

A BETA nyelv szintaxisa



A BETA nyelv szintaxisa

A szintaxis leírására a következő szabályokat használjuk:

Négy előredefiniált nemterminális van: <NameDecl>, <NameAppl>, <String>, <Const>. A kezdőszimbólum a <BetaForm>.

<BetaForm> ::| <DescriptorForm>
             | <AttributesForm>
<DescriptorForm> ::= <ObjectDescriptor>
<AttributesForm> ::= <Attributes>
<ObjectDescriptor> ::= <SuperPattenrOpt> <MainPart>
<MainPart> ::= (# <Attributes> <ActionPart> #)
<Attributes> ::+ <AttributeDeclOpt> ;
<SuperPattern> ::? <SuperPattern>
<SuperPattern> ::= <AttributeDenotation>
<AttributeDeclOpt> ::? <AttributeDecl>
<AttributeDecl> ::| <PatternDecl>
                  | <SimpleDecl>
                  | <RepetitionDecl>
                  | <VirtualDecl>
                  | <BindingDecl>
                  | <FinalBindingDecl>
                  | <VariablePatternDecl>
<PatternDecl> ::= <Names> : <ObjectDescriptor>
<SimpleDecl> ::= <Names> : <referenceSpecification>
<RepetitionDecl>::= <Names> : [ <index> ] <referenceSpecification>
<VirtualDecl> ::= <Names> :< <ObjectSpecification>
<BindingDecl> ::= <Names> :: < <ObjectSpecification>
<FinalBindingDecl> ::= <Names> :: <ObjectSpecification>
<VariablePatternDecl> ::= <Names> : ## <AttributeDenotation>
<referenceSpecification> ::| <StaticItem>
                           | <DynamicItem>
                           | <StaticComponent>
                           | <DynamicComponent>
<StaticItem> ::= @ <ObjectSpecification>
<DynamicItem> ::= ^ <AttributeDenotation>
<StaticComponent> ::= @ | <ObjectSpecification>
<DynamicComponent> ::= ^ | <AttributeDenotation>
<ObjectSpecification> ::| <ObjectDescriptor>
                        | <AttributeDenotation>
<Index> ::| <SimpleIndex>
          | <NamedIndex>
<NamedIndex> ::= <NameDcl> : <Evaluation>
<ActionPart> ::= <EnterPartOpt> <DoPartOpt> <ExitPartOpt>
<EnterPartOpt> ::? <EnterPart>
<DoPartOpt> ::? <DoPart>
<ExitPartOpt> ::? <ExitPart>
<EnterPart> ::= enter <Evaluation>
<DoPart> ::= do <Imperatives>
<ExitPart> ::= exit <Evaluation>
<Imperatives> ::+ <ImpOpt> ;
<ImpOpt> ::? <Imp>
<Imp> ::| <LabelledImp>
        | <LabelledCompoundImp>
        | <ForImp>
        | <IfImp>
        | <LeaveImp>
        | <RestartImp>
        | <InnerImp>
        | <SuspendImp>
        | <Evaluation>
<LabelledImp> ::= <NameDcl> : <Imp>
<LabelledCompoundImp> ::= ( <NameDcl> <Imperatives> <NameDcl> )
<ForImp> ::= (for <Index> repeat <Imperatives> for)
<IfImp> ::= (if <Evaluation> <Alternatives> <ElsePartOpt> if)
<Alternatives> ::+ <Alternative>
<Alternative> ::= <Selections> then <Imperatives>
<Selections>::+ <Selection>
<Selection> ::| <CaseSelection>
<CaseSelection> ::= // <evaluation>
<ElsePartOpt> ::? <ElsePart>
<ElsePart> ::= else <Imperatives>
<LeaveImp> ::= leave <NameApl>
<RestartImp> ::= restart <NameApl>
<InnerImp> ::= inner <NameAplOpt>
<NameAplOpt> ::? <NameApl>
<SuspendImp> ::= suspend
<Evaluations> ::+ <Evaluation> ,
<Evaluation> ::| <Expression>
               | <AssignmentEvaluation>
<AssignmentEvaluation> ::= <Evaluation> -> <Transaction>
<Transaction> ::| <ObjectEvaluation>
                | <ComputedObjectEvaluation>
                | <ObjectReference>
                | <EvalList>
                | <StructureReference>
<ObjectEvaluation> ::| <InsertedItem>
                     | <reference>
<Reference> ::| <ObjectDenotation>
              | <DynamicObjectGeneration>
<DynamicObjectGeneration> ::| <DynamicItemGeneration>
                            | <DynamicComponentGeneration>
<InsertedItem> ::= <ObjectDescriptor>
<ObjectDenotation> ::= <AttributeDenotation>
<ComputedObjectEvaluation> ::= <ObjectEvaluation> !
<ObjectReference> ::= <Reference> []
<StructureReference> ::= <AttributeDenotation> ##
<EvalList> ::= ( <Evaluations> )
<DynamicItemGeneration> ::= & <ObjectSpecification>
<DynamicComponentGeneration> ::= & | <ObjectSpecification>
<AttributeDenotation>::| <NameApl>
                       | <Remote>
                       | <ComputedRemote>
                       | <Indexed>
                       | <ThisObject>
<Remote> ::= <AttributeDenotation> . <NameApl>
<ComputedRemote> ::= ( <Evaluations> ) . <NameApl>
<Indexed> ::= <AttributeDenotation> [ <Evaluation> ]
<ThisObject> ::= this ( <NameApl> )
<Expression> ::| <RelationalExp> | <SimpleExp>
<RelationalExp>::| <EqExp> | <LtExp> | <LeExp>
                 | <GtExp> | <GeExp> | <NeExp>
<SimpleExp> ::| <AddExp> | <SignedTerm> | <Term>
<AddExp> ::| <PlusExp> | <MinusExp> | <OrExp>
<SignedTerm> ::| <unaryPlusExp> | <unaryMinusexp>
<Term> ::| <MulExp> | <Factor>
<MulExp> ::| <TimesExp> | <DivExp> | <ModExp> | <AndExp>
<EqExp> ::= <Operand1:SimpleExp> = <Operand2:SimpleExp>
<LtExp> ::= <Operand1:SimpleExp> < <Operand2:SimpleExp>
<LeExp> ::= <Operand1:SimpleExp> <= <Operand2:SimpleExp>
<GtExp> ::= <Operand1:SimpleExp> > <Operand2:SimpleExp>
<GeExp> ::= <Operand1:SimpleExp> >= <Operand2:SimpleExp>
<NeExp> ::= <Operand1:SimpleExp> <> <Operand2:SimpleExp>
<PlusExp> ::= <SimpleExp> + <Term>
<MinusExp> ::= <SimpleExp> - <Term>
<OrExp> ::= <SimpleExp> or <Term>
<unaryPlusExp> ::= + <Term>
<unaryMinusExp> ::= - <Term>
<TimesExp> ::= <Term> * <Factor>
<DivExp> ::= <Term> div <Factor>
<ModExp> ::= <Term> mod <Factor>
<AndExp> ::= <Term> and <Factor>
<Factor> ::| <TextConst>
           | <IntegerConst>
           | <NotExp>
           | <NoneExp>
           | <RepetitionSlice>
           | <Transaction>
<RepetitionSlice> ::= <AttributeDenotation>
               [ <Evaluation> : <Evaluation> ]
<notExp> ::= not <factor>
<noneExp> ::= none
<Names> ::+ <NameDcl> ,
<NameDcl> ::= <NameDecl>
<NameApl> ::= <NameAppl>
<SimpleEntry> ::? <TextConst>
<TextConst> ::= <String>
<IntegerConst> ::= <Const>
<SimpleIndex> ::= <Evaluation>