Re: [BLACKBOX] Capsula language
Hello Carl,
Is there a website from where to dowload CAPSULA language support?
Thanks: René Dorta.
On Wed, Aug 14, 2013 at 5:52 PM, Carl Glassberg <carlglassberg{([at]})nowhere.xy
Hello Dr. Bautsch:
Interesting language & syntax, Capsula.
[Isn't Capsula the name of a wild mushroom in Italy? Just kidding, probably a good name.]
Dr Bautsch, is possible? to re-write the syntax rule for Loop, in simplified, but equivalent form, as:
Loop = "While" "<-" PreTestCondition "->" { Statement } "<-" PostTestCondition .
The following, with changes to the Wiki to remove embedded spaces inside string literals and replacement
of the arrow symbols by "->', "<-", and "<--->", will pass the simple EBNF "checker" example supplied with Coco/R:
I did not try to create a Capsula.ATG grammar file for input to Coco/R. Coco/R would likely complain about missing lexical token definitions for Integer, Real, etc. and some rules are probably non-LL(1). A goal rule, Capsula = Unit EOF .
would be added to any Capsula.ATG grammar.
I probably left out some rules or made other mistakes, so this is probably not complete nor will it be accepted by Coco/R as is, but the EBNF checker did not complain.
Sincerely,
Carl Glassberg
------>
(* Capsula syntax, preliminary interpretation by cmg of official Wiki definition by Dr. Bautsch: *)
Identifier = Letter { Letter | Digit } .
QualifiedIdentifier = { Identifier "." } Identifier .
Designator = QualifiedIdentifier { ( "[" IntegerExpression "]" ) | ( "." Identifier ) } .
Interface = Identifier "is" Visibility .
Visibility = Private | Public .
Signature = Interface Type .
ListElements = Unit | Constant | Type | Variable | FormalParameter | Command | Function | ActualParameter | Statement | Case .
Unit = Package | Module .
Package = "Package" Interface { Unit } .
Module = "Module" Interface { Constant } { Type } { Variable } { Command } { Function } [ Init ] [ Exit ] .
Init = "initModule" { Statements } .
Exit = "exitModule" { Statements } .
Constant = "Constant" Signature ConstantExpression .
ConstantExpression = Expression .
Type = "Type" Interface "is" ( BasicType | ComplexType ) .
BasicType = Boolean | Integer | Real .
Boolean = "False" | "True" .
ComplexType = QualifiedIdentifier | Array | String | Class .
Array = "Array" length "of" ( BasicType | ComplexType ) .
length = ConstantIntegerExpression .
ArrayDesignator = Designator .
ArrayTypeDesignator = QualifiedIdentifier .
ArrayCreation = ArrayDesignator "<--->" ArrayTypeDesignator "." "newArray" length .
Class = Flexibility Extendibility "extension" "of" ParentIdentifier { Variable } { Command } { Function } .
Flexibility = Static | Dynamic .
Extendibility = Final | Extensible | Abstract .
ParentIdentifier = QualifiedIdentifier .
ClassInstanceDesignator = Designator .
ClassTypeDesignator = QualifiedIdentifier .
ClassCreation = ClassInstanceDesignator "<--->" ClassTypeDesignator "." "newClass" .
Variable = "Variable" Signature .
FormalParameter = "Parameter" Signature .
Body = { FormalParameter } { Constant } { Variable } { Statement } .
Command = "Command" Interface Body .
Function = "Function" Signature Body .
Expression = BooleanExpression | IntegerExpression | RealExpression | StringExpression | Designator | "Nil" .
BooleanOperand = "False" | "True" | Designator .
BooleanExpression = BooleanOperand | BooleanOperation .
BooleanOperation = BooleanUnaryOperation | BooleanUnaryIntegerOperation | BooleanBinaryOperation | Relation .
BooleanUnaryOperation = BooleanUnaryOperator BooleanOperand .
BooleanUnaryOperator = "Not" .
BooleanUnaryIntegerOperation = BooleanUnaryIntegerOperator BooleanOperand .
BooleanUnaryIntegerOperator = "Even" | "Odd" .
BooleanBinaryOperation = BooleanOperand BooleanBinaryOperator BooleanOperand .
BooleanBinaryOperator = "And" | "Or" | "Equal" | "NotEqual" .
Relation = IntegerRelation | RealRelation | StringRelation .
IntegerRelation = IntegerOperand IntegerRelationOperator IntegerOperand .
IntegerRelationOperator = IntegerIsEqual | IntegerIsNotEqual | IntegerIsLess | IntegerIsLessOrEqual | IntegerIsGreaterOrEqual | IntegerIsGreater .
RealRelation = RealOperand RealRelationOperator RealOperand .
RealRelationOperator = RealEqual | RealNotEqual | RealLess | RealLessOrEqual | RealGreaterOrEqual | RealGreater .
StringRelation = StringOperand StringRelationOperator StringOperand .
StringRelationOperator = StringEqual | StringNotEqual | StringLess | StringLessOrEqual | StringGreaterOrEqual | StringGreater .
IntegerOperand = Integer | Designator .
IntegerExpression = IntegerOperand | IntegerOperation .
IntegerOperation = IntegerUnaryOperation | IntegerUnaryRealOperation | IntegerBinaryOperation .
IntegerUnaryOperation = IntegerUnaryOperator IntegerOperand .
IntegerUnaryOperator = IntegerNegation | IntegerAbsolute .
IntegerUnaryRealOperation = IntegerUnaryRealOperator RealOperand .
IntegerUnaryRealOperator = IntegerFloor .
IntegerBinaryOperation = IntegerOperand IntegerBinaryOperator IntegerOperand .
IntegerBinaryOperator = IntegerSum | IntegerDifference | IntegerProduct | IntegerQuotient | IntegerModulo | IntegerMinimum | IntegerMaximum .
RealOperand = Real | Integer | Designator .
RealExpression = RealOperand | IntegerOperand | RealOperation .
RealOperation = RealUnaryOperation | RealBinaryOperation RealUnaryOperator | RealOperand .
RealUnaryOperator = RealNegation | RealAbsolute .
RealBinaryOperation = RealOperand RealBinaryOperator RealOperand .
RealBinaryOperator = RealSum | RealDifference | RealProduct | RealQuotient | RealMinimum | RealMaximum .
StringOperand = String | Designator | "Nil" .
StringExpression = { StringOperand } .
ActualParameter = Expression .
Call = "->" Designator { ActualParameter } .
Statement = CommandCall | Assignment | Branch | Loop .
CommandCall = Call .
Assignment = Designator "<-" Expression | FunctionCall .
FunctionCall = Call .
Branch = BooleanBranch | IntegerBranch | TypeBranch .
BooleanBranch = "If" BooleanExpression [ TrueStatements ] [ FalseStatements ] .
TrueStatements = "True" "->" { Statement } .
FalseStatements = "False" "->" { Statement } .
IntegerBranch = "If" IntegerExpression "is" { IntegerCase } [ IntegerElse ] .
IntegerCase = ConstantIntegerExpression "->" { Statement } .
IntegerElse = "IntegerElse" "->" { Statement } .
TypeBranch = "If" Designator { TypeCase } [ TypeElse ] .
TypeCase = ConstantTypeExpression "->" { Statement } .
TypeElse = "TypeElse" "->" { Statement } .
PreTestCondition = BooleanExpression .
PostTestCondition = BooleanExpression .
Loop = "While" "<-" PreTestCondition "->" { Statement } "<-" PostTestCondition .
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX"
to LISTSERV{([at]})nowhere.xy
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Fri Aug 16 2013 - 03:06:19 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:29:51 UTC