next up previous
Next: Avoiding conflicts in the parser Up: The ALLCOT syntax Previous: Arithmetic and boolean expressions

Programs

We give now a grammar for ALLCOT programs.

Program $ \longmapsto$ DefinitionSequence MainSequence
DefinitionSequence $ \longmapsto$ CategoryDefinition DefinitionSequence
DefinitionSequence $ \longmapsto$ DomainDefinition DefinitionSequence
DefinitionSequence $ \longmapsto$ $ \varepsilon$

CategoryDefinition $ \longmapsto$ id: Category == ParentCategory WithBody
ParentCategory $ \longmapsto$ id
ParentCategory $ \longmapsto$ $ \varepsilon$
WithBody $ \longmapsto$ with { FunctionDeclarationSequence }
FunctionDeclarationSequence $ \longmapsto$ FunctionDeclaration ; FunctionDeclarationSequence
FunctionDeclarationSequence $ \longmapsto$ $ \varepsilon$
FunctionDeclaration $ \longmapsto$ id : ( TypeSequence ) $ \longrightarrow$ TypeOrVoid
TypeSequence $ \longmapsto$ $ \varepsilon$
TypeSequence $ \longmapsto$ Type
TypeSequence $ \longmapsto$ Type , MoreTypes
MoreTypes $ \longmapsto$ Type
MoreTypes $ \longmapsto$ Type , MoreTypes
Type $ \longmapsto$ %
Type $ \longmapsto$ id
TypeOrVoid $ \longmapsto$ Type
TypeOrVoid $ \longmapsto$ ( )
DomainDefinition $ \longmapsto$ id: id == ParentDomain AddBody
ParentDomain $ \longmapsto$ id
ParentDomain $ \longmapsto$ $ \varepsilon$
AddBody $ \longmapsto$ add { AttribStatement ;
    FunctionDefinitionSequence }
FunctionDefinitionSequence $ \longmapsto$ FunctionDefinition FunctionDefinitionSequence
FunctionDefinitionSequence $ \longmapsto$ $ \varepsilon$
FunctionDefinition $ \longmapsto$ id ( FormalParameterSequence ) :
    TypeOrVoid == FunctionBody
FormalParameterSequence $ \longmapsto$ $ \varepsilon$
FormalParameterSequence $ \longmapsto$ FormalParameter
FormalParameterSequence $ \longmapsto$ FormalParameter , MoreFormalParameters
MoreFormalParameters $ \longmapsto$ FormalParameter
MoreFormalParameters $ \longmapsto$ FormalParameter , MoreFormalParameters
FormalParameter $ \longmapsto$ id: Type
FunctionBody $ \longmapsto$ Statement ;
FunctionBody $ \longmapsto$ { StatementSequence }
StatementSequence $ \longmapsto$ Statement ;
StatementSequence $ \longmapsto$ Statement ; StatementSequence

MainSequence $ \longmapsto$ MainDefinition MainCall
MainDefinition $ \longmapsto$ main (): () == { StatementSequence }
MainCall $ \longmapsto$ main () ;


next up previous
Next: Avoiding conflicts in the parser Up: The ALLCOT syntax Previous: Arithmetic and boolean expressions
Marc Moreno Maza
2004-12-01