Qaqao Syntax

2.2 Semantic Syntax

2.1.1 Qaqao Top-Level Script Elements

Qaqao_compiler_script ::

Qaqao_script_message ::

Import_message ::

The outer list must contain one or two elements: a single tuple beginning with the string “objects”, and/or a single tuple beginning with the string “packages”.


Export_message ::

The outer list must contain exactly two elements: a single tuple beginning with the string “objects” and a single tuple beginning with the string “to-packages”.


Interface_message ::

The outer list must contain exactly one element: a single tuple beginning with the string “declarations”.


Implement_message ::

The outer list must contain one or two elements: an optional tuple beginning with the string “declarations”, and a single tuple beginning with the string “definitions”.


Definition_statement ::

2.1.2 Qaqao Statements

Statement ::
    Declaration_statement
    Binding_statement
    Send_statement
    Receive_statement
    SendReceive_statement
    Local_statement
    Sequential_statement
    Concurrent_statement
    If_statement
    Case_statement
    Loop_statement
    ForEach_statement
    ForAll_statement
    BreakFromLoopIf_statement

Declaration_statement ::
    Tuple [Declarative_expression Simple_expression]

Binding_statement ::
    Tuple [Bound_expression«Expression]

Send_statement ::
    Tuple [Bound_expressionBound_expression]

Receive_statement ::
    Tuple [ExpressionBound_expression]

SendReceive_statement ::
    Tuple [Bound_expressionBound_expressionBound_expression]

Local_statement ::
    Tuple [“localStatement]

Sequential_statement ::
    Sequential_list {Statement}

Concurrent_statement ::
    Concurrent_list (Statement)

If_statement ::
    Tuple [“ifSimple_expressionthenDoStatement
    (“elseIfSimple_expressionthenDoStatement)*
    (“elseDoStatement)?]

Case_statement ::
    Tuple [“caseSimple_expressionof
    Concurrent_list (Tuple [“whenConcurrent_list (Simple_expression) “doStatement])
    (“elseDoStatement)?]

Loop_statement ::
    Tuple [“loopSequential_statement]

ForEach_statement ::
    Tuple [“forEachSimple_identifierinExpressiondoStatement]

ForAll_statement ::
    Tuple [“forAllSimple_identifierinExpressiondoStatement]

BreakFromLoopIf_statement ::
    Tuple [“breakFromLoopIfSimple_expression]

NOTE: A BreakFromLoopIf statement is only allowed in the body of a Loop or a ForEach statement. At least one such statement must occur in the body of every Loop statement, outside the body of any nested loop (including ForAll loops.


2.1.3 Qaqao Expressions

Expression ::
    Declarative_expression
    Bound_expression
    Send_expression
    Let_expression
    Sequence_expression
    Vector_expression
    If_expression
    Case_expression
    ForEach_expression
    ForAll_expression
    Infix_expression
    Statement

Simple_expression ::
    Declarative_expression
    Bound_expression
    Send_expression
    Let_expression
    If_expression
    Case_expression
    Infix_expression

Declaration_expression ::
    Tuple [Declarative_expression Simple_expression]


Send_expression ::
    Tuple [Bound_expressionBound_expression]


Let_expression ::
    Tuple [“letStatementinExpression]

Sequence_expression ::
    Sequential_list {Expression}

Vector_expression ::
    Concurrent_list (Expression)

If_expression ::
    Tuple [“ifSimple_expressionthenExpression
    (“elseIfSimple_expressionthenExpression)*
    elseExpression]

Case_expression ::
    Tuple [“caseSimple_expressionof
    Concurrent_list (Tuple [“whenConcurrent_list (Simple_expression) “yieldExpression])
    elseYieldExpression]

ForEach_expression ::
    Tuple [“forEachSimple_identifierinExpressionyieldExpression]

ForAll_expression ::
    Tuple [“forAllSimple_identifierinExpressionyieldExpression]

Infix_expression ::
    Tuple [Operator* Expression (Operator+ Expression)*]

Declarative_expression ::
    Identifier
    Declarative_parameter_expression

Declarative_parameter_expression ::
    Tuple [Simple_identifier Concurrent_list (Parameter_declaration_expression)]

Parameter_declaration_expression ::
    Tuple [Simple_identifier Simple_expression (“defaultExpression)?]

Bound_expression ::
    Identifier
    Bound_parameter_expression

Bound_parameter_expression ::
    Tuple [Simple_identifier Concurrent_list (Parameter_binding_Expression)]

Parameter_binding_expression ::
    Tuple [Simple_identifier«Expression]

Identifier ::
    Simple_identifier
    Compound_identifier

2.1.4 Infix Expressions

Standard Qaqao Operators

Category Operator Unicode Operation Associativity
Parenthetical ⌈ ⌉
⌊ ⌋
⟨ ⟩
&u+2308 &u+2309
&u+230A &u+230B
&u+2329 &u+232A
ceiling
floor
absolute value
parenthetical
Sign &u+2212 negate prefix
Exponential &u+2191 exponentiate right
Multiplicative ×
÷
%
&u+00D7
&u+00F7
&u+0025
multiply
divide
remainder
left
Additive +
&u+002B
&u+2212
add
subtract
left
Shifting
&u+219E
&u+21A0
shift left
shift right
left
Comparative
=

<

>
&u+2261
&u+003D
&u+2260
&u+003C
&u+2264
&u+003E
&u+2265
identical to
equal to
not equal to
less than
less than or equal to
greater than
greater than or equal to
none
Negative ¬ &u+00AC not prefix
Conjunctive &u+2227 and left
Disjunctive &u+2228 or left

Qaqao Language Definition, section 2.2, version 0.40α

© J. Andrew Holey, 2012

email: jholey@csbsju.edu