Beta Grammar

contractioncategories 
   MainPart Attributes Imperatives
--- beta : aGrammar : metagrammar ---

Grammar beta :

Option

  version  = 9
  comBegin = '(*'
  comEnd   = '*)'
  stringChar = '\'' 
  splitString = true
  suffix = '.bet'

Rule

  <BetaForm>  ::| <DescriptorForm> 
                | <AttributesForm>
                ;
  <DescriptorForm> ::= <ObjectDescriptor>
                    ;
  <AttributesForm> ::= <Attributes>
                    ;
  <ObjectDescriptor> ::= <PrefixOpt> <MainPart> 
                      ;
  <MainPart> ::= '(#' <Attributes> <ActionPart> '#)'
              ;
  <Attributes> ::+ <AttributeDeclOpt> ';';

  <PrefixOpt> ::? <Prefix>;

  <Prefix> ::= <AttributeDenotation>;

  <AttributeDeclOpt>    ::? <AttributeDecl>;

  <AttributeDecl> ::| <PatternDecl> 
                    | <SimpleDecl>
                    | <RepetitionDecl> 
                    | <VirtualDecl>
                    | <BindingDecl>
                    | <FinalDecl>
                    | <ErrorDecl>
                    ;

  <PatternDecl> ::= <Names> ':' <ObjectDescriptor>;

  <SimpleDecl>  ::= <Names> ':' <referenceSpecification>;

  <RepetitionDecl>::= <Names> ':' '[' <index> ']' <referenceSpecification>;

  <VirtualDecl> ::= <Names> ':' '<' <ObjectSpecification>;

  <BindingDecl> ::= <Names> ':' ':' '<' <ObjectSpecification>;

  <FinalDecl> ::= <Names> ':' ':' <ObjectSpecification>;

  <VariablePattern> ::=  '##' <AttributeDenotation>;

  <referenceSpecification> ::| <StaticItem>
                             | <DynamicItem>
                             | <StaticComponent>
                             | <DynamicComponent>
                             | <VariablePattern>
                             ;

  <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>
          | <ForImp>
          | <SimpleIfImp> 
          | <GeneralIfImp> 
          | <LeaveImp>
          | <RestartImp>
          | <InnerImp>
          | <SuspendImp>
          | <Evaluation>
          | <CodeImp>
          | <errorImp>;

  <LabelledImp> ::= <NameDcl> ':' <Imp>;

  <ForImp> ::= '(' 'for' <Index> 'repeat' <Imperatives> 'for' ')';

  <GeneralIfImp> ::= '(' 'if' <Evaluation> <Alternatives> <ElsePartOpt> 'if' ')';

  <SimpleIfImp> ::= '(' 'if' <Evaluation> 'then' <Imperatives> <ElsePartOpt> 'if' ')';

  <LeaveImp> ::= 'leave' <NameApl>;

  <RestartImp>  ::= 'restart' <NameApl>;

  <InnerImp>    ::= 'inner' <NameAplOpt>;

  <NameAplOpt> ::? <NameApl> ;

  <SuspendImp>  ::= 'suspend' ;

  <CodeImp>     ::= '(' 'code' <CodeItems> 'code' ')';

  <Alternatives> ::+ <Alternative> ;
  <Alternative> ::= <Selections> 'then' <Imperatives>;

  <Selections>::+ <Selection> ;
  <Selection> ::| <CaseSelection> ;

  <CaseSelection> ::= '//' <evaluation>;

  <ElsePartOpt>  ::? <ElsePart>;
  <ElsePart>    ::= 'else' <Imperatives>;
 
  <Evaluations> ::+ <Evaluation> ',';

  <Evaluation>  ::| <Expression> 
                  | <AssignmentEvaluation>;

  <AssignmentEvaluation> ::= <Evaluation> '->' <Transaction>;

  <Transaction> ::| <ObjectEvaluation>
                  | <ComputedObjectEvaluation>
                  | <ObjectReference> 
                  | <EvalList> 
                  | <StructureReference>
                  | <Primitive>
                  | <Address>
                  ;
  <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>;
  <Primitive>   ::= 'tos' <SimpleEntry>;
  <Address>     ::= '@@'  <AttributeDenotation>;

  <AttributeDenotation>::| <NameApl>
                         | <Remote>
                         | <ComputedRemote>
                         | <Indexed> 
                         | <ThisObject>
                         | <RemotePrimitive>
                         ; 
  <Remote> ::= <AttributeDenotation> '.' <NameApl>;
  <ComputedRemote> ::= '(' <Evaluations> ')' '.' <NameApl> ;
  <Indexed> ::= <AttributeDenotation> '[' <Evaluation> ']';
  <ThisObject> ::= 'this' '(' <NameApl> ')' ;
  <RemotePrimitive> ::= <AttributeDenotation> '.%' <NameApl>;

  <Expression>  ::| <RelationalExp> | <SimpleExp> ;

  <RelationalExp>::| <EqExp> | <LtExp> | <LeExp> 
                   | <GtExp> | <GeExp> | <NeExp>
                   ;

  <SimpleExp>   ::| <AddExp> | <SignedTerm> | <Term> ; 

  <AddExp>      ::| <PlusExp> | <MinusExp> | <OrExp> | <XorExp>;

  <SignedTerm> ::| <unaryPlusExp> | <unaryMinusexp>;

  <Term>        ::| <MulExp> | <Factor> ; 

  <MulExp>      ::| <TimesExp> | <RealDivExp> | <IntDivExp> 
                  | <ModExp> | <AndExp> | <PrimitiveExp> ;
 
  <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>;
  <XorExp>       ::= <SimpleExp> 'xor' <Term>;

  <unaryPlusExp> ::= '+' <Term>;
  <unaryMinusExp> ::= '-' <Term>;

  <TimesExp>    ::= <Term> '*' <Factor>;
  <RealDivExp>  ::= <Term> '/' <Factor>;
  <IntDivExp>   ::= <Term> 'div' <Factor>;      
  <ModExp>      ::= <Term> 'mod' <Factor>;
  <AndExp>      ::= <Term> 'and' <Factor>;

  <PrimitiveExp> ::= <Term> '%' <NameApl> <Factor> ;

  <Factor>      ::| <TextConst>
                  | <IntegerConst>
                  | <NotExp>
                  | <NoneExp>
                  | <RepetitionSlice>
                  | <Transaction>
                  | <UnaryPrimitiveExp>
                  ;

  <RepetitionSlice> ::= <AttributeDenotation> 
                        '[' <Low:Evaluation> ':' <High:Evaluation> ']' ;
  <notExp>      ::= 'not' <factor>;
  <noneExp>     ::= 'none';
  <UnaryPrimitiveExp> ::= '%' <NameApl> <factor>; 

  <Names> ::+ <NameDcl> ',';
  <NameDcl> ::= <NameDecl>;
  <NameApl> ::= <NameAppl>;
                   
  <SimpleEntry> ::? <TextConst>;
  <TextConst>   ::= <String>;
  <IntegerConst> ::= <Const>;

  <SimpleIndex> ::= <Evaluation>;

  <CodeItems> ::+ <CodeItem> ',';
  <CodeItem>    ::| <CodeString> | <CodeConst>;
  <CodeString>  ::= <String>;
  <CodeConst>   ::= <Const>;

(* now for the errorproductions *)
  <ErrorDecl>   ::= Error; 
  <ErrorImp>    ::= Error

Attribute


<ObjectSpecification> : 0
<Attributes> : 0

<DescriptorForm> : 18
<AttributesForm> : 18
<ObjectDescriptor> : 8
<MainPart> : 2
<DoPart> : 2
<ForImp> : 2
<repetitionDecl> : 2
<LabelledImp> : 2
<nameDcl> : 2
<nameApl> : 4
<bindingDecl> : 2
<FinalDecl> : 2
<InsertedItem> : 2
<ObjectDenotation> : 2
<ComputedObjectEvaluation> : 2
<RepetitionSlice>:2
<ObjectReference> : 2
<EvalList> : 2
<Address> : 2
<Primitive> : 2
<DynamicItemGeneration> : 2
<DynamicComponentGeneration> : 2

<EqExp> : 2 
<LtExp> : 2 
<LeExp> : 2
<GtExp> : 2 
<GeExp> : 2 
<NeExp> : 2 
<PlusExp>  : 2
<MinusExp>  : 2 
<OrExp> : 2
<XorExp> : 2
<MulExp>  : 2 
<TimesExp>  : 2
<RealDivExp>  : 2 
<IntDivExp>  : 2 
<ModExp>  : 2
<AndExp> : 2

<EnterPart> : 2
<ExitPart> : 2


<DescriptorForm>:
(# descNo: integer;
   Xorigin: AST;
   sysAtt: integer
#)
<AttributesForm>:
(# Xorigin: AST;
   descNo: integer;
   dclRoot: NameDcl;
   lib: AST;
   kind: integer
#)
<ObjectDescriptor>:
(# descNo: integer;
   origin: AST;
   size: integer;
   attSize: integer;
   mark: int16u;
   kind: int8u;
   type: int8u;
   dclRoot: NameDcl;
   lib: AST;
   returnOff: integer;
   originOff: integer
#)
<MainPart>:
(# descNo: integer;
   xorigin: AST
#)
<RepetitionDecl>:
(# origin: AST
#)
<EnterPart>:
(# NXOff: integer;
   NXSize: integer
#)
<DoPart>:
(# xorigin: AST;
   descNo: integer
#)
<ExitPart>:
(# NXOff: integer;
   NXSize: integer
#)
<LabelledImp>:
(# origin: AST
#)
<ForImp>:
(# off: integer;
   origin: AST
#)
<InsertedItem>:
(# insOff: integer 
#)
<ObjectDenotation>:
(# evalkind: integer
#)
<Expression>:
(# eval1: integer;
   eval2: integer
#)
<RepetitionSlice>:
(# evalKind: integer
#)
<nameDcl>:
(# left: NameDcl;
   right: NameDcl;
   access: integer;
   off: integer;
   virtDcl: AST;
   restartAdr: integer;
   leaveAdr: integer
#)
<nameApl>:
(# on: integer;
   pn: integer;
   dclRef: NameDcl;
   onForThis: integer;
   descRef: AST;
   origin: AST
#)


Beta Grammar
© 1990-2004 Mjølner Informatics
[Modified: Monday April 5th 2004 at 3:12]